Curve.PointAndDerivatives method (Visio)
Returns a point and its derivatives at a position along a curve's path.
Syntax
expression.PointAndDerivatives (t, n, x, y, dxdt, dydt, ddxdt, ddydt)
expression A variable that represents a Curve object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
t | Required | Double | The value in the curve's parameter domain to evaluate. |
n | Required | Integer | 0: get point; 1: point and 1st derivative; 2: point plus first and second derivative. |
x | Required | Double | Returns x value of curve at t. |
y | Required | Double | Returns y value of curve at t. |
dxdt | Required | Double | Returns first derivative ( dx/dt) at t if n > 0. |
dydt | Required | Double | Returns first derivative ( dy/dt) at t if n> 0. |
ddxdt | Required | Double | Returns second derivative ( ddx/dt) at t if n> 1. |
ddydt | Required | Double | Returns second derivative ( ddy/dt) at t if n> 1. |
Return value
Nothing
Remarks
Use the PointAndDerivatives method of the Curve object to obtain the coordinates of a point within the curve's parameter domain and its first and second derivatives.
A Curve object is described in terms of its parameter domain, which is the range [Start(),End()]. The PointAndDerivatives method can be used to extrapolate the curve's path outside [Start(),End()].
Example
This Microsoft Visual Basic for Applications (VBA) macro draws an oval on the document's active page and then retrieves it and iterates through its Paths collection and each Path object to display the coordinates of various points along the curve. Because the shape drawn is an oval, it contains only one path and only one Curve object.
Sub PointAndDerivatives_Example()
Dim vsoShape As Visio.Shape
Dim vsoPaths As Visio.Paths
Dim vsoPath As Visio.Path
Dim vsoCurve As Visio.Curve
Dim dblStartpoint As Double
Dim dblXCoordinate As Double
Dim dblYCoordinate As Double
Dim dblFirstDerivativeX As Double
Dim dblFirstDerivativeY As Double
Dim dblSecondDerivativeX As Double
Dim dblSecondDerivativeY As Double
Dim intOuterLoopCounter As Integer
Dim intInnerLoopCounter As Integer
'Get the Paths collection for this shape.
Set vsoPaths = ActivePage.DrawOval(1, 1, 4, 4).Paths
'Iterate through the Path objects in the Paths collection.
For intOuterLoopCounter = 1 To vsoPaths.Count
Set vsoPath = vsoPaths.Item(intOuterLoopCounter)
Debug.Print "Path object " & intOuterLoopCounter
'Iterate through the curves in a Path object.
For intInnerLoopCounter = 1 To vsoPath.Count
Set vsoCurve = vsoPath(intInnerLoopCounter)
Debug.Print "Curve number " & intInnerLoopCounter
'Display the start point of the curve.
dblStartpoint = vsoCurve.Start
Debug.Print "Startpoint= " & dblStartpoint
'Use the PointAndDerivatives method to obtain
'a point and the first derivative at that point.
vsoCurve.PointAndDerivatives (dblStartpoint - 1), 1, _
dblXCoordinate, dblYCoordinate, dblFirstDerivativeX, dblFirstDerivativeY, dblSecondDerivativeX, dblSecondDerivativeY
Debug.Print "PointAndDerivative= " & dblXCoordinate, dblYCoordinate, dblFirstDerivativeX, dblFirstDerivativeY
Next intInnerLoopCounter
Debug.Print "This path has " & intInnerLoopCounter - 1 & " curve object(s)."
Next intOuterLoopCounter
Debug.Print "This shape has " & intOuterLoopCounter - 1 & " path object(s)."
End Sub
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.