Rhino C++ API  8.7
Public Member Functions | List of all members
ON_Polyline Class Reference

#include <opennurbs_polyline.h>

Inheritance diagram for ON_Polyline:
ON_3dPointArray ON_SimpleArray< ON_3dPoint >

Public Member Functions

 ON_Polyline ()
 
 ON_Polyline (const ON_3dPointArray &)
 
 ~ON_Polyline ()
 
int Clean (double tolerance=0.0)
 
ON_3dPoint ClosestPointTo (const ON_3dPoint &test_point) const
 
bool ClosestPointTo (const ON_3dPoint &test_point, double *t) const
 
bool ClosestPointTo (const ON_3dPoint &test_point, double *t, int segment_index0, int segment_index1) const
 
bool CreateCircumscribedPolygon (const ON_Circle &circle, int side_count)
 
bool CreateInscribedPolygon (const ON_Circle &circle, int side_count)
 
bool CreateStarPolygon (const ON_Circle &circle, double other_radius, int side_count)
 
ON_3dVector DerivativeAt (double t) const
 
bool IsClosed (double tolerance=0.0) const
 
bool IsConvexLoop (bool bStrictlyConvex) const
 
bool IsValid (double tolerance=0.0) const
 
double Length () const
 
ON_Polylineoperator= (const ON_3dPointArray &)
 
ON_3dPoint PointAt (double t) const
 
int PointCount () const
 
ON_Line Segment (int segment_index) const
 
int SegmentCount () const
 
ON_3dVector SegmentDirection (int segment_index) const
 
ON_3dVector SegmentTangent (int segment_index) const
 
ON_3dVector TangentAt (double t) const
 
- Public Member Functions inherited from ON_3dPointArray
 ON_3dPointArray ()
 see ON_SimpleArray class definition comments for constructor documentation More...
 
 ON_3dPointArray (const ON_SimpleArray< ON_3dPoint > &)
 
 ON_3dPointArray (const ON_SimpleArray< ON_3fPoint > &)
 
 ON_3dPointArray (int)
 
ON_BoundingBox BoundingBox () const
 
ON_BoundingBox BoundingBox (int from, int count) const
 
bool Create (int point_dimension, int bRational, int point_count, int point_stride, const double *points)
 
bool Create (int point_dimension, int bRational, int point_count, int point_stride, const float *points)
 
bool GetBBox (double boxmin[3], double boxmax[3], bool bGrowBox=false) const
 
bool GetBoundingBox (ON_BoundingBox &bbox, int bGrowBox=false) const
 
bool GetClosestPoint (ON_3dPoint P, int *closest_point_index, double maximum_distance=0.0) const
 
bool GetTightBoundingBox (ON_BoundingBox &tight_bbox, bool bGrowBox=false, const ON_Xform *xform=nullptr) const
 
ON_3dPointArrayoperator= (const ON_3dPointArray &)
 
ON_3dPointArrayoperator= (const ON_SimpleArray< ON_3fPoint > &)
 
bool PointMassProperties (class ON_MassProperties &mp, bool bFirstMoments=true, bool bSecondMoments=true, bool bProductMoments=true) const
 
bool Rotate (double angle_in_radians, const ON_3dVector &axis_of_rotation, const ON_3dPoint &center_of_rotation)
 
bool Rotate (double sin_angle, double cos_angle, const ON_3dVector &axis_of_rotation, const ON_3dPoint &center_of_rotation)
 
bool SwapCoordinates (int i, int j)
 
bool Transform (const ON_Xform &xform)
 
bool Translate (const ON_3dVector &delta)
 
- Public Member Functions inherited from ON_SimpleArray< ON_3dPoint >
 ON_SimpleArray () ON_NOEXCEPT
 construction //////////////////////////////////////////////////////// More...
 
 ON_SimpleArray (const ON_SimpleArray< ON_3dPoint > &)
 Copy constructor. More...
 
 ON_SimpleArray (size_t)
 size_t parameter = initial capacity More...
 
virtual ~ON_SimpleArray ()
 
void Append (const ON_3dPoint &)
 
void Append (int, const ON_3dPoint *)
 Append copy of an array T[count]. More...
 
ON_3dPointAppendNew ()
 array operations //////////////////////////////////////////////////// More...
 
ON_3dPointArray ()
 The Array() function return the. More...
 
const ON_3dPointArray () const
 m_a pointer value. More...
 
ON_3dPointAt (int)
 At(index) returns nullptr if index < 0 or index >= count. More...
 
const ON_3dPointAt (int) const
 
ON_3dPointAt (ON__INT64)
 
const ON_3dPointAt (ON__INT64) const
 
ON_3dPointAt (ON__UINT64)
 
const ON_3dPointAt (ON__UINT64) const
 
ON_3dPointAt (unsigned int)
 
const ON_3dPointAt (unsigned int) const
 
int BinarySearch (const ON_3dPoint *, int(*)(const ON_3dPoint *, const ON_3dPoint *)) const
 See Also: ON_CompareIncreasing<T> and ON_CompareDeccreasing<T> More...
 
int BinarySearch (const ON_3dPoint *, int(*)(const ON_3dPoint *, const ON_3dPoint *), int) const
 
const ON_3dPointBinarySearchPtr (const ON_3dPoint *, int(*)(const ON_3dPoint *, const ON_3dPoint *)) const
 
const ON_3dPointBinarySearchPtr (const ON_3dPoint *, int(*)(const ON_3dPoint *, const ON_3dPoint *), int) const
 
int Capacity () const
 capacity of array More...
 
int Count () const
 query /////////////////////////////////////////////////////////////// More...
 
ON__UINT32 DataCRC (ON__UINT32 current_remainder) const
 
void Destroy ()
 onfree any memory and set count and capacity to zero More...
 
void EmergencyDestroy (void)
 emergency bailout /////////////////////////////////////////////////// More...
 
void Empty ()
 Sets count to 0, leaves capacity untouched. More...
 
ON_3dPointFirst ()
 
const ON_3dPointFirst () const
 returns nullptr if count = 0 More...
 
bool HeapSort (int(*)(const ON_3dPoint *, const ON_3dPoint *))
 
void Insert (int, const ON_3dPoint &)
 
int InsertInSortedList (const ON_3dPoint &, int(*)(const ON_3dPoint *, const ON_3dPoint *))
 
int InsertInSortedList (const ON_3dPoint &, int(*)(const ON_3dPoint *, const ON_3dPoint *), int)
 
ON_3dPointKeepArray ()
 
ON_3dPointLast ()
 
const ON_3dPointLast () const
 returns nullptr if count = 0 More...
 
void MemSet (unsigned char)
 
int NewCapacity () const
 
 operator const ON_3dPoint * () const
 
 operator ON_3dPoint * ()
 The cast operators return a pointer. More...
 
ON_SimpleArray< ON_3dPoint > & operator= (const ON_SimpleArray< ON_3dPoint > &)
 
ON_3dPointoperator[] (int)
 
const ON_3dPointoperator[] (int) const
 
ON_3dPointoperator[] (ON__INT64)
 
const ON_3dPointoperator[] (ON__INT64) const
 
ON_3dPointoperator[] (ON__UINT64)
 
const ON_3dPointoperator[] (ON__UINT64) const
 
ON_3dPointoperator[] (unsigned int)
 
const ON_3dPointoperator[] (unsigned int) const
 
bool Permute (const int *)
 
void Prepend (int, const ON_3dPoint *)
 Prepend copy of an array T[count]. More...
 
bool QuickSort (int(*)(const ON_3dPoint *, const ON_3dPoint *))
 See Also: ON_CompareIncreasing<T> and ON_CompareDeccreasing<T> More...
 
bool QuickSortAndRemoveDuplicates (int(*)(const ON_3dPoint *, const ON_3dPoint *))
 See Also: ON_CompareIncreasing<T> and ON_CompareDeccreasing<T> More...
 
virtual ON_3dPointRealloc (ON_3dPoint *, int)
 low level memory management ////////////////////////////////////////// More...
 
void Remove ()
 
virtual void Remove (int)
 
void RemoveIf (bool predicate(const ON_3dPoint &key))
 
void RemoveValue (const ON_3dPoint &)
 
ON_3dPointReserve (size_t)
 memory management //////////////////////////////////////////////////// More...
 
void Reverse ()
 reverse order More...
 
int Search (const ON_3dPoint &) const
 
int Search (const ON_3dPoint *, int(*)(const ON_3dPoint *, const ON_3dPoint *)) const
 See Also: ON_CompareIncreasing<T> and ON_CompareDeccreasing<T> More...
 
void SetArray (ON_3dPoint *)
 
void SetArray (ON_3dPoint *, int, int)
 
ON_3dPointSetCapacity (size_t)
 
void SetCount (int)
 low level memory management ////////////////////////////////////////// More...
 
void SetRange (int from, int count, ON_3dPoint)
 
void Shrink ()
 remove unused capacity More...
 
unsigned int SizeOfArray () const
 amount of memory in the m_a[] array More...
 
unsigned int SizeOfElement () const
 amount of memory in an m_a[] array element More...
 
bool Sort (ON::sort_algorithm sort_algorithm, int *, int(*)(const ON_3dPoint *, const ON_3dPoint *)) const
 
bool Sort (ON::sort_algorithm sort_algorithm, int *, int(*)(const ON_3dPoint *, const ON_3dPoint *, void *), void *) const
 
void Swap (int, int)
 swap elements i and j More...
 
unsigned int UnsignedCount () const
 
void Zero ()
 

Additional Inherited Members

- Protected Member Functions inherited from ON_SimpleArray< ON_3dPoint >
void Move (int, int, int)
 implementation ////////////////////////////////////////////////////// More...
 
- Protected Attributes inherited from ON_SimpleArray< ON_3dPoint >
ON_3dPointm_a
 pointer to array memory More...
 
int m_capacity
 actual length of m_a[] More...
 
int m_count
 0 <= m_count <= m_capacity More...
 

Detailed Description

Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert McNeel & Associates.

THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED.

For complete openNURBS copyright information see http://www.opennurbs.org.

Constructor & Destructor Documentation

◆ ON_Polyline() [1/2]

ON_Polyline::ON_Polyline ( )

◆ ~ON_Polyline()

ON_Polyline::~ON_Polyline ( )

◆ ON_Polyline() [2/2]

ON_Polyline::ON_Polyline ( const ON_3dPointArray )

Member Function Documentation

◆ Clean()

int ON_Polyline::Clean ( double  tolerance = 0.0)

Description: Removes duplicate points that result in zero length segments. Parameters: tolerance - [in] tolerance used to check for duplicate points. Returns: Number of points removed. Remarks: If the distance between points polyline[i] and polyline[i+1] is <= tolerance, then the point with index (i+1) is removed.

◆ ClosestPointTo() [1/3]

ON_3dPoint ON_Polyline::ClosestPointTo ( const ON_3dPoint test_point) const

Description: Find a point on the polyline that is closest to test_point. Parameters: test_point - [in] Returns: point on polyline.

◆ ClosestPointTo() [2/3]

bool ON_Polyline::ClosestPointTo ( const ON_3dPoint test_point,
double *  t 
) const

Description: Find a point on the polyline that is closest to test_point. Parameters: test_point - [in] t - [out] parameter for a point on the polyline that is closest to test_point. If multiple solutions exist, then the smallest solution is returned. Returns: true if successful.

◆ ClosestPointTo() [3/3]

bool ON_Polyline::ClosestPointTo ( const ON_3dPoint test_point,
double *  t,
int  segment_index0,
int  segment_index1 
) const

Description: Find a point on the polyline that is closest to test_point. Parameters: test_point - [in] t - [out] parameter for a point on the polyline that is closest to test_point. If multiple solutions exist, then the smallest solution is returned. segment_index0 - [in] index of segment where search begins segment_index1 - [in] index of segment where search ends This segment is NOT searched. Example: Search segments 3,4, and 5 for the point closest to (0,0,0). double t; ClosestPointTo( ON_3dPoint(0,0,0), &t, 3, 6 ); Returns: true if successful.

Parameters
segment_index0index of segment where search begins
segment_index1index + 1 of segment where search stops

◆ CreateCircumscribedPolygon()

bool ON_Polyline::CreateCircumscribedPolygon ( const ON_Circle circle,
int  side_count 
)

Description: Create a regular polygon circumscribe about a circle. The midpoints of the polygon's edges will be tangent to the circle. Parameters: circle - [in] side_count - [in] (>=3) number of sides Returns: true if successful. false if circle is invalid or side_count < 3.

◆ CreateInscribedPolygon()

bool ON_Polyline::CreateInscribedPolygon ( const ON_Circle circle,
int  side_count 
)

Description: Create a regular polygon inscribed in a circle. The vertices of the polygon will be on the circle. Parameters: circle - [in] side_count - [in] (>=3) number of sides Returns: true if successful. false if circle is invalid or side_count < 3.

◆ CreateStarPolygon()

bool ON_Polyline::CreateStarPolygon ( const ON_Circle circle,
double  other_radius,
int  side_count 
)

Description: Create a regular star polygon. The star begins at circle.PointAt(0) and the vertices alternate between being on circle and begin on a concentric circle of other_radius. Parameters: circle - [in] circle star polygon starts on other_radius - [in] radius of other circle corner_count - [in] (>=3) number of corners on circle There will be 2*corner_count sides and 2*corner_count vertices. Returns: true if successful. false if circle is invalid, other_radius < 0.0, or side_count < 3.

◆ DerivativeAt()

ON_3dVector ON_Polyline::DerivativeAt ( double  t) const

Description: Evaluate the polyline first derivative at a parameter. Parameters: t - [in] the i-th segment goes from i <= t < i+1

◆ IsClosed()

bool ON_Polyline::IsClosed ( double  tolerance = 0.0) const

Description: Test a polyline to see if it is closed. Returns: true if polyline has 4 or more points, the distance between the start and end points is <= tolerance, and there is a point in the polyline whose distance from the start and end points is > tolerance.

◆ IsConvexLoop()

bool ON_Polyline::IsConvexLoop ( bool  bStrictlyConvex) const

Description: Determine if a polyline is convex. Parameters: bStrictlyConvex - [in] If false, colinear segments are considered convex.
Returns True if the polyline is a closed, convex loop.

◆ IsValid()

bool ON_Polyline::IsValid ( double  tolerance = 0.0) const

Description: Checks that polyline has at least two points and that sequential points are distinct. If the polyline has 2 or 3 points, then the start and end point must be distinct. Parameters: tolerance - [in] tolerance used to check for duplicate points. Returns: true if polyline is valid. See Also: ON_Polyline::Clean.

◆ Length()

double ON_Polyline::Length ( ) const

Returns: Length of the polyline.

◆ operator=()

ON_Polyline& ON_Polyline::operator= ( const ON_3dPointArray )

◆ PointAt()

ON_3dPoint ON_Polyline::PointAt ( double  t) const

Description: Evaluate the polyline location at a parameter. Parameters: t - [in] the i-th segment goes from i <= t < i+1

◆ PointCount()

int ON_Polyline::PointCount ( ) const

Returns: Number of points in the polyline.

◆ Segment()

ON_Line ON_Polyline::Segment ( int  segment_index) const

Parameters: segment_index - [in] zero based segment index Returns: line = point[segment_index] -> point[segment_index+1]

◆ SegmentCount()

int ON_Polyline::SegmentCount ( ) const

Returns: Number of segments in the polyline.

◆ SegmentDirection()

ON_3dVector ON_Polyline::SegmentDirection ( int  segment_index) const

Parameters: segment_index - [in] zero based segment index Returns: vector = point[segment_index+1] - point[segment_index].

◆ SegmentTangent()

ON_3dVector ON_Polyline::SegmentTangent ( int  segment_index) const

Parameters: segment_index - [in] zero based segment index Returns: Unit vector in the direction of the segment

◆ TangentAt()

ON_3dVector ON_Polyline::TangentAt ( double  t) const

Description: Evaluate the polyline unit tangent at a parameter. Parameters: t - [in] the i-th segment goes from i <= t < i+1