70001805 I wish to get the Tangent Vector at a point of a vdCurve

Article 70001805
Type Wish
Product Engine
Version 8005
Date Added 7/24/2020
Fixed 8.8006.0.1 (8/24/2020)
Submitted by lpch534

Summary

I wish to get the Tangent Vector at a point of a vdCurve

Solution

A new method getTangentAtPoint of vdCurve was added in version 8006.0.1

Syntax:

Vector getTangentAtPoint(gPoint pickPoint, out gPoint pointOnCurve)

Returns : the Tangent Vector direction from a point on the curve in World Coordinate System
pickPoint : A point in WCS near to to the curve boundary
pointOnCurve : The closest point to pickPoint that lies on the curve in WCS
The return Vector direction is always in the Counter ClockWise of the given arc and in World Coordinate System


Implementd for vdArc , vdCircle , vdEllipse and arc segments of vdPolyline entities


Example:

                //Prompt the user to select an Arc , Circle, Ellipse or Pline with Arc segments and if success draw the tangent line from the pick point on Curve
                vdCurve crv;
                vdFigure fig;
                gPoint pt;
                doc.Prompt("Pick Point on a Curve");
                StatusCode sc =  doc.ActionUtility.getUserEntity(out fig, out pt);
                doc.Prompt(null);
                if (sc != StatusCode.Success) return;
                crv = fig as vdCurve;
                if (crv == null) return;
                gPoint pointoncurve;
                Vector tang = crv.getTangentAtPoint(pt, out pointoncurve);
                if (tang == null) return;
                vdLine testline = new vdLine(doc, pointoncurve, pointoncurve + tang) { PenColor = new vdColor(Color.Red) };
                doc.Model.Entities.Add(testline);
                doc.Redraw(true);

Send comments on this topic.