AnglePath

AnglePath[{θ1,θ2,θ3,}]

gives the list of 2D coordinates corresponding to a path that starts at {0,0}, then takes a series of steps of unit length at successive relative angles θi.

AnglePath[{{r1,θ1},{r2,θ2},{r3,θ3},}]

takes successive steps of lengths ri.

AnglePath[θ0,{step1,step2,}]

starts at angle θ0 with respect to the axis.

AnglePath[{x,y},{step1,step2,}]

starts at the point {x,y} with initial angle 0 with respect to the axis.

AnglePath[{{x,y},θ0},{step1,step2,}]

starts at {x,y} with initial angle θ0 with respect to the axis.

AnglePath[{{x,y},{dx,dy}},{step1,step2,}]

takes the first step to go from {x,y} to {x+dx,y+dy}.

AnglePath[init,steps,form]

returns at each step the data of the form specified by form.

Details and Options

  • At each point reached in the formation of a path, AnglePath in effect first rotates by the specified relative angle, then advances by the specified distance.
  • Unless explicitly given as Quantity objects, the angles θi are assumed to be in radians, increasing counterclockwise. (Multiply by Degree to convert from degrees.)
  • In AnglePath[{θ1,θ2,θ3,}], the angle θ1 is assumed to be relative to the axis.
  • Possible choices for form in AnglePath[,form] include:
  • "Position"Cartesian coordinates {xi,yi} (default)
    "FrameMatrix"rotation matrix of the current frame with respect to the initial frame
    "RelativeMatrix"rotation matrix of the current frame with respect to the previous frame
    "FrameAngle"rotation angle with respect to the initial step
    "RelativeAngle"rotation angle with respect to the previous step
    "Translation"translation transformation from the initial step
    "Rotation"rotation transformation from the initial step
    "RotationTranslation"rotation-translation transformation from the initial step
    {form1,form2,}list of forms
  • The arguments of AnglePath can be symbolic. They can also be Quantity objects.
  • AnglePath has the option WorkingPrecision, which determines the precision of numbers generated.
  • With the default setting WorkingPrecisionAutomatic, exact numbers will be generated for exact input only for fairly short paths; for longer paths, machine precision will be used.

Examples

open all close all

Basic Examples  (5)

Starting at {0,0} along the axis, move several unit steps, rotating 90° before each step:

In[1]:=
Click for copyable input
Out[1]=

A polyline of three segments:

In[1]:=
Click for copyable input
Out[1]=

Advance 20 steps, always turning 110° toward the left:

In[1]:=
Click for copyable input
Out[1]=

Generate the transformation functions of a path:

In[1]:=
Click for copyable input
Out[1]=

Apply them to a turtle:

In[2]:=
Click for copyable input
Out[2]=

Use symbolic input:

In[1]:=
Click for copyable input
Out[1]=

Scope  (13)

Options  (1)

Applications  (3)

Properties & Relations  (5)

Possible Issues  (1)

Interactive Examples  (1)

Neat Examples  (2)

Introduced in 2015
(10.1)
|
Updated in 2019
(12.0)