SimpleClosedPath - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


ComputationalGeometry

  

SimpleClosedPath

  

determine an order of points so they form a simple closed path

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

SimpleClosedPath( P )

SimpleClosedPath( P, a )

Parameters

P

-

2-D array of point coordinates (in the same form as the array in PointOrientation for highest efficiency), or a listlist of point coordinates

a

-

(optional) the index of the point from which to start the curve. The point with minimal y-coordinate is used by default. The output is not guaranteed to be simple unless the anchor is on the convex hull.

Description

• 

The SimpleClosedPath command returns a list of indices of the points in P so that they form a non-self-intersecting polygon in counterclockwise orientation.

• 

The algorithm starts with an anchor point a and sorts the remaining points by the angle of the segment they form with a. The angle is not computed explicitly, but rather PointOrientation is used to determine the order implicitly.

Examples

withComputationalGeometry:

P0.17,0.13,0.39,0.74,0.76,0.68,0.93,0.85,0.036,0.66,0.96,0.79,0.92,0.42,0.14,0.80,0.48,0.96,0.97,0.16,0.96,0.96,0.55,0.28,0.098,0.63,0.91,0.13,0.91,0.82

P0.17,0.13,0.39,0.74,0.76,0.68,0.93,0.85,0.036,0.66,0.96,0.79,0.92,0.42,0.14,0.80,0.48,0.96,0.97,0.16,0.96,0.96,0.55,0.28,0.098,0.63,0.91,0.13,0.91,0.82

(1)

P is not a simple polygon in the order given

plots:-polygonplotP,style=line

pathSimpleClosedPathP

path1,14,10,7,12,6,3,15,4,11,9,2,8,13,5

(2)

The output of SimpleClosedPath is a simple polygon.

plots:-polygonplotseqPi,iinpath,style=line

There are many possible orders; the convex hull gives some but not all of them.

chConvexHullP

ch10,11,9,8,5,1,14

(3)

Mplots:-displayMatrix2,4,seqplots:-polygonplotseqPi,iinSimpleClosedPathP,c,color=c,scaling=constrained,title=catanchor=,c,cinch,INTERFACE_PLOTAXESSTYLENONE

Compatibility

• 

The ComputationalGeometry[SimpleClosedPath] command was introduced in Maple 2023.

• 

For more information on Maple 2023 changes, see Updates in Maple 2023.

See Also

PointOrientation