Table of contents
TOC
Collapse the table of content
Expand the table of content

Curve.PointAndDerivatives Method (Visio)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

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

NameRequired/OptionalData TypeDescription
tRequiredDoubleThe value in the curve's parameter domain to evaluate.
nRequiredInteger0: get point; 1: point and 1st derivative; 2: point plus first and second derivative.
xRequiredDoubleReturns x value of curve at t.
yRequiredDoubleReturns y value of curve at t.
dxdtRequiredDoubleReturns first derivative ( dx/dt) at t if n > 0.
dydtRequiredDoubleReturns first derivative ( dy/dt) at t if n> 0.
ddxdtRequiredDoubleReturns second derivative ( ddx/dt) at t if n> 1.
ddydtRequiredDoubleReturns 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
© 2018 Microsoft