Rhino C++ API  7.22
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
ON_PlaneEquation Class Reference

#include <opennurbs_point.h>

Public Member Functions

 ON_PlaneEquation ()
 
 ON_PlaneEquation (double xx, double yy, double zz, double dd)
 
ON_3dPoint ClosestPointTo (ON_3dPoint point) const
 
bool Create (ON_3dPoint P, ON_3dVector N)
 
ON_3dVector Direction () const
 
double DirectionLength () const
 
void Dump (class ON_TextLog &) const
 
bool IsNearerThan (const class ON_BezierCurve &bezcrv, double s0, double s1, int sample_count, double endpoint_tolerance, double interior_tolerance, double *smin, double *smax) const
 
int IsParallelTo (const ON_PlaneEquation &other, double angle_tolerance=ON_DEFAULT_ANGLE_TOLERANCE) const
 
bool IsSet () const
 
bool IsUnitized () const
 
bool IsValid () const
 
double MaximumAbsoluteValueAt (bool bRational, int point_count, int point_stride, const double *points, double stop_value) const
 
double MaximumCoefficient () const
 
double MaximumValueAt (bool bRational, int point_count, int point_stride, const double *points, double stop_value) const
 
double MaximumValueAt (const class ON_CurveLeafBox &crvleafbox) const
 
double MaximumValueAt (const class ON_SurfaceLeafBox &srfleafbox) const
 
double MaximumValueAt (const ON_BoundingBox &bbox) const
 
double MinimumValueAt (bool bRational, int point_count, int point_stride, const double *points, double stop_value) const
 
double MinimumValueAt (const class ON_CurveLeafBox &crvleafbox) const
 
double MinimumValueAt (const class ON_SurfaceLeafBox &srfleafbox) const
 
double MinimumValueAt (const ON_BoundingBox &bbox) const
 
ON_PlaneEquation NegatedPlaneEquation () const
 
bool operator!= (const ON_PlaneEquation &) const
 
bool operator== (const ON_PlaneEquation &) const
 
double & operator[] (int)
 
double operator[] (int) const
 
double & operator[] (unsigned int)
 
double operator[] (unsigned int) const
 
bool Transform (const ON_Xform &xform)
 
ON_PlaneEquation UnitizedPlaneEquation () const
 
ON_3dVector UnitNormal () const
 
double ValueAt (double x, double y, double z) const
 
double * ValueAt (int Pcount, const ON_3dPoint *P, double *value, double value_range[2]) const
 
double * ValueAt (int Pcount, const ON_3fPoint *P, double *value, double value_range[2]) const
 
double ValueAt (ON_3dPoint P) const
 
double ValueAt (ON_3dVector P) const
 
double ValueAt (ON_4dPoint P) const
 
ON_Interval ValueRange (const class ON_3dPointListRef &point_list) const
 
ON_Interval ValueRange (const ON_SimpleArray< ON_3dPoint > &point_list) const
 
ON_Interval ValueRange (const ON_SimpleArray< ON_3fPoint > &point_list) const
 
ON_Interval ValueRange (size_t point_index_count, const unsigned int *point_index_list, const class ON_3dPointListRef &point_list) const
 
ON_Interval ValueRange (size_t point_index_count, size_t point_index_stride, const unsigned int *point_index_list, const class ON_3dPointListRef &point_list) const
 
ON_Interval ValueRange (size_t point_list_count, const ON_3dPoint *point_list) const
 
ON_Interval ValueRange (size_t point_list_count, const ON_3fPoint *point_list) const
 
double ZeroTolerance () const
 

Static Public Member Functions

static const ON_PlaneEquation CreateFromPointAndNormal (ON_3dPoint point, ON_3dVector normal)
 
static const ON_PlaneEquation CreateFromThreePoints (ON_3dPoint pointA, ON_3dPoint pointB, ON_3dPoint pointC)
 
static void Set (ON_PlaneEquation &plane_equation, double x, double y, double z, double d)
 

Public Attributes

double d
 4th coefficient of the plane equation. More...
 
double x
 
double y
 
double z
 

Static Public Attributes

static const ON_PlaneEquation NanPlaneEquation
 (ON_DBL_QNAN,ON_DBL_QNAN,ON_DBL_QNAN,ON_DBL_QNAN) More...
 
static const ON_PlaneEquation UnsetPlaneEquation
 (ON_UNSET_VALUE,ON_UNSET_VALUE,ON_UNSET_VALUE,ON_UNSET_VALUE) More...
 
static const ON_PlaneEquation WorldXY
 (0,0,1,0) More...
 
static const ON_PlaneEquation WorldYZ
 (1,0,0,0) More...
 
static const ON_PlaneEquation WorldZX
 (0,1,0,0) More...
 
static const ON_PlaneEquation ZeroPlaneEquation
 (0.0,0.0,0.0,0.0) More...
 

Detailed Description

Description: Typically the vector portion is a unit vector and m_d = -(x*P.x + y*P.y + z*P.z) for a point P on the plane.

Constructor & Destructor Documentation

◆ ON_PlaneEquation() [1/2]

ON_PlaneEquation::ON_PlaneEquation ( )

◆ ON_PlaneEquation() [2/2]

ON_PlaneEquation::ON_PlaneEquation ( double  xx,
double  yy,
double  zz,
double  dd 
)

Member Function Documentation

◆ ClosestPointTo()

ON_3dPoint ON_PlaneEquation::ClosestPointTo ( ON_3dPoint  point) const

Description: Get point on plane that is closest to a given point. Parameters: point - [in] Returns: A 3d point on the plane that is closest to the input point.

◆ Create()

bool ON_PlaneEquation::Create ( ON_3dPoint  P,
ON_3dVector  N 
)

Description: Sets (x,y,z) to a unitized N and then sets d = -(x*P.x + y*P.y + z*P.z). Parameters: P - [in] point on the plane N - [in] vector perpendicular to the plane Returns: true if input is valid.

◆ CreateFromPointAndNormal()

static const ON_PlaneEquation ON_PlaneEquation::CreateFromPointAndNormal ( ON_3dPoint  point,
ON_3dVector  normal 
)
static

Returns: If point is valid and normal is nonzero, a unitized plane equation is returned. Otherwise ON_PlaneEquation::NanPlaneEquation is returned.

◆ CreateFromThreePoints()

static const ON_PlaneEquation ON_PlaneEquation::CreateFromThreePoints ( ON_3dPoint  pointA,
ON_3dPoint  pointB,
ON_3dPoint  pointC 
)
static

Returns: If the three points are valid and not colinear, a unitized plane equation is returned. Otherwise ON_PlaneEquation::NanPlaneEquation is returned.

◆ Direction()

ON_3dVector ON_PlaneEquation::Direction ( ) const

Returns: Direction (x,y,z)

◆ DirectionLength()

double ON_PlaneEquation::DirectionLength ( ) const

◆ Dump()

void ON_PlaneEquation::Dump ( class ON_TextLog ) const

◆ IsNearerThan()

bool ON_PlaneEquation::IsNearerThan ( const class ON_BezierCurve bezcrv,
double  s0,
double  s1,
int  sample_count,
double  endpoint_tolerance,
double  interior_tolerance,
double *  smin,
double *  smax 
) const

Description: Test points on a bezier curve to see if they are near the plane. Parameters: bezcrv - [in] s0 - [in] s1 - [in] the interval from s0 to s1 is tested (s0 < s1) sample_count - [in] number of interior points to test.
Numbers like 1, 3, 7, 15, ... work best. endpoint_tolerance - [in] If >= 0, then the end points are tested to see if the distance from the endpoints is <= endpoint_tolerance. interior_tolerance - [in] (>=0 and >=endpoint_tolerance) This tolerance is used to test the interior sample points. smin - [put] If not nullptr, *smin = bezier parameter of nearest test point. smax - [put] If not nullptr, *smax = bezier parameter of farthest test point. If false is returned, this is the parameter of the test point that failed. Returns: True if all the tested points passed the tolerance test. False if at least one tested point failed the tolerance test. (The test terminates when the first failure is encountered.)

◆ IsParallelTo()

int ON_PlaneEquation::IsParallelTo ( const ON_PlaneEquation other,
double  angle_tolerance = ON_DEFAULT_ANGLE_TOLERANCE 
) const

Returns 1: this and other vectors are parallel -1: this and other vectors are anti-parallel 0: this and other vectors are not parallel or at least one of the vectors is zero

Parameters
otherother plane equation
angle_toleranceoptional angle tolerance (radians)

◆ IsSet()

bool ON_PlaneEquation::IsSet ( ) const

Description: returns true if x, y, z, d are valid, finite doubles and at least one of x, y or z is not zero.

◆ IsUnitized()

bool ON_PlaneEquation::IsUnitized ( ) const

Description: returns true if x, y, z, d are valid, finite doubles and x^2 + y^2 + z^2 = 1.

◆ IsValid()

bool ON_PlaneEquation::IsValid ( ) const

Description: returns true if x, y, z, d are valid, finite doubles. Remarks: this function will return true if x, y and z are all zero. See Also: ON_PlaneEquation::IsSet().

◆ MaximumAbsoluteValueAt()

double ON_PlaneEquation::MaximumAbsoluteValueAt ( bool  bRational,
int  point_count,
int  point_stride,
const double *  points,
double  stop_value 
) const

Description: Get the maximum absolute value of the plane equation on a set of 3d points. Parameters: bRational - [in] False if the points are euclidean (x,y,z) True if the points are homogenous rational (x,y,z,w) (x/w,y/w,z/w) is used to evaluate the value. point_count - [in] point_stride - [in] i-th point's x coordinate = points[i*point_stride] points - [in] coordinates of points stop_value - [in] If stop_value >= 0.0, then the evaulation stops if an absolute value > stop_value is found. If stop_value < 0.0 or stop_value is invalid, then stop_value is ignored. Returns: Maximum value of the plane equation on the point list. If the input is not valid, then ON_UNSET_VALUE is returned.

◆ MaximumCoefficient()

double ON_PlaneEquation::MaximumCoefficient ( ) const

◆ MaximumValueAt() [1/4]

double ON_PlaneEquation::MaximumValueAt ( bool  bRational,
int  point_count,
int  point_stride,
const double *  points,
double  stop_value 
) const

Description: Get the maximum value of the plane equation on a set of 3d points. Parameters: bRational - [in] False if the points are euclidean (x,y,z) True if the points are homogenous rational (x,y,z,w) (x/w,y/w,z/w) is used to evaluate the value. point_count - [in] point_stride - [in] i-th point's x coordinate = points[i*point_stride] points - [in] coordinates of points stop_value - [in] If stop_value is valid and not ON_UNSET_VALUE, then the evaulation stops if a value > stop_value is found. If stop_value = ON_UNSET_VALUE, then stop_value is ignored. Returns: Maximum value of the plane equation on the point list. If the input is not valid, then ON_UNSET_VALUE is returned.

◆ MaximumValueAt() [2/4]

double ON_PlaneEquation::MaximumValueAt ( const class ON_CurveLeafBox crvleafbox) const

Description: Get the maximum value of the plane equation on a bounding box. Parameters: crvleafbox - [in] Returns: Maximum value of the plane equation on the curve leaf box.

◆ MaximumValueAt() [3/4]

double ON_PlaneEquation::MaximumValueAt ( const class ON_SurfaceLeafBox srfleafbox) const

Description: Get the maximum value of the plane equation on a bounding box. Parameters: bbox - [in] Returns: Maximum value of the plane equation on the bounding box.

◆ MaximumValueAt() [4/4]

double ON_PlaneEquation::MaximumValueAt ( const ON_BoundingBox bbox) const

Description: Get the maximum value of the plane equation on a bounding box. Parameters: bbox - [in] Returns: Maximum value of the plane equation on the bounding box.

◆ MinimumValueAt() [1/4]

double ON_PlaneEquation::MinimumValueAt ( bool  bRational,
int  point_count,
int  point_stride,
const double *  points,
double  stop_value 
) const

Description: Get the minimum value of the plane equation on a set of 3d points. Parameters: bRational - [in] False if the points are euclidean (x,y,z) True if the points are homogenous rational (x,y,z,w) (x/w,y/w,z/w) is used to evaluate the value. point_count - [in] point_stride - [in] i-th point's x coordinate = points[i*point_stride] points - [in] coordinates of points stop_value - [in] If stop_value is valid and not ON_UNSET_VALUE, then the evaulation stops if a value < stop_value is found. If stop_value = ON_UNSET_VALUE, then stop_value is ignored. Returns: Maximum value of the plane equation on the point list. If the input is not valid, then ON_UNSET_VALUE is returned.

◆ MinimumValueAt() [2/4]

double ON_PlaneEquation::MinimumValueAt ( const class ON_CurveLeafBox crvleafbox) const

Description: Get the minimum value of the plane equation on a bounding box. Parameters: crvleafbox - [in] Returns: Minimum value of the plane equation on the curve leaf box.

◆ MinimumValueAt() [3/4]

double ON_PlaneEquation::MinimumValueAt ( const class ON_SurfaceLeafBox srfleafbox) const

Description: Get the minimum value of the plane equation on a bounding box. Parameters: bbox - [in] Returns: Minimum value of the plane equation on the bounding box.

◆ MinimumValueAt() [4/4]

double ON_PlaneEquation::MinimumValueAt ( const ON_BoundingBox bbox) const

Description: Get the minimum value of the plane equation on a bounding box. Parameters: bbox - [in] Returns: Minimum value of the plane equation on the bounding box.

◆ NegatedPlaneEquation()

ON_PlaneEquation ON_PlaneEquation::NegatedPlaneEquation ( ) const

Returns: The plane equation whose coefficient values are the negative of the coefficent values in this, provided the coeffient value is valid. Any invalid coefficent values are copied.

◆ operator!=()

bool ON_PlaneEquation::operator!= ( const ON_PlaneEquation ) const

◆ operator==()

bool ON_PlaneEquation::operator== ( const ON_PlaneEquation ) const

◆ operator[]() [1/4]

double& ON_PlaneEquation::operator[] ( int  )

index operators mimic double[4] behavior Return null refs or ON_UNSET_VALUE for out-of-range indices

◆ operator[]() [2/4]

double ON_PlaneEquation::operator[] ( int  ) const

◆ operator[]() [3/4]

double& ON_PlaneEquation::operator[] ( unsigned int  )

◆ operator[]() [4/4]

double ON_PlaneEquation::operator[] ( unsigned int  ) const

◆ Set()

static void ON_PlaneEquation::Set ( ON_PlaneEquation plane_equation,
double  x,
double  y,
double  z,
double  d 
)
static

◆ Transform()

bool ON_PlaneEquation::Transform ( const ON_Xform xform)

Description: Transform the plane equation so that, if e0 is the initial equation, e1 is transformed equation and P is a point, then e0.ValueAt(P) = e1.ValueAt(xform*P). Parameters: xform - [in] Invertable transformation. Returns: True if the plane equation was successfully transformed. False if xform is not invertable or the equation is not valid. Remarks: This function has to invert xform. If you have apply the same transformation to a bunch of planes, then it will be more efficient to calculate xform's inverse transpose and apply the resultingt transformation to the equation's coefficients as if they were 4d point coordinates.

◆ UnitizedPlaneEquation()

ON_PlaneEquation ON_PlaneEquation::UnitizedPlaneEquation ( ) const

Returns: The plane equation whose first three coefficient values are a unit vector.

◆ UnitNormal()

ON_3dVector ON_PlaneEquation::UnitNormal ( ) const

Returns: Unitized direction or zero vector if not set.

◆ ValueAt() [1/6]

double ON_PlaneEquation::ValueAt ( double  x,
double  y,
double  z 
) const

◆ ValueAt() [2/6]

double* ON_PlaneEquation::ValueAt ( int  Pcount,
const ON_3dPoint P,
double *  value,
double  value_range[2] 
) const

◆ ValueAt() [3/6]

double* ON_PlaneEquation::ValueAt ( int  Pcount,
const ON_3fPoint P,
double *  value,
double  value_range[2] 
) const

Description: Evaluate the plane at a list of point values. Parameters: Pcount - [in] number of points P - [in] points value - [in] If not null, value[] must be an array of length at least Pcount. The values will be stored in this array. If null, the an array will be allocated with onmalloc() and returned. value_range - [out] If not null, the range of values will be returned here. Returns: An array of Pcount values. If the input parameter value was null, then the array is allocated on the heap using onmalloc() and the caller is responsible for calling onfree() when finished. If the input is not valid, null is returned.

◆ ValueAt() [4/6]

double ON_PlaneEquation::ValueAt ( ON_3dPoint  P) const

Description: Evaluate the plane at a point. Parameters: P - [in] Returns: x*P.x + y*P.y + z*P.z + d;

◆ ValueAt() [5/6]

double ON_PlaneEquation::ValueAt ( ON_3dVector  P) const

◆ ValueAt() [6/6]

double ON_PlaneEquation::ValueAt ( ON_4dPoint  P) const

◆ ValueRange() [1/7]

ON_Interval ON_PlaneEquation::ValueRange ( const class ON_3dPointListRef point_list) const

Returns: ON_Interval::EmptyInterval if input is not valid.

◆ ValueRange() [2/7]

ON_Interval ON_PlaneEquation::ValueRange ( const ON_SimpleArray< ON_3dPoint > &  point_list) const

Returns: ON_Interval::EmptyInterval if input is not valid.

◆ ValueRange() [3/7]

ON_Interval ON_PlaneEquation::ValueRange ( const ON_SimpleArray< ON_3fPoint > &  point_list) const

Returns: ON_Interval::EmptyInterval if input is not valid.

◆ ValueRange() [4/7]

ON_Interval ON_PlaneEquation::ValueRange ( size_t  point_index_count,
const unsigned int *  point_index_list,
const class ON_3dPointListRef point_list 
) const

Returns: ON_Interval::EmptyInterval if input is not valid.

◆ ValueRange() [5/7]

ON_Interval ON_PlaneEquation::ValueRange ( size_t  point_index_count,
size_t  point_index_stride,
const unsigned int *  point_index_list,
const class ON_3dPointListRef point_list 
) const

◆ ValueRange() [6/7]

ON_Interval ON_PlaneEquation::ValueRange ( size_t  point_list_count,
const ON_3dPoint point_list 
) const

Returns: ON_Interval::EmptyInterval if input is not valid.

◆ ValueRange() [7/7]

ON_Interval ON_PlaneEquation::ValueRange ( size_t  point_list_count,
const ON_3fPoint point_list 
) const

Returns: ON_Interval::EmptyInterval if input is not valid.

◆ ZeroTolerance()

double ON_PlaneEquation::ZeroTolerance ( ) const

Description: This function calculates and evalutes points that would be exactly on the plane if double precision aritmetic were mathematically perfect and returns the largest value of the evaluations.

Member Data Documentation

◆ d

double ON_PlaneEquation::d

4th coefficient of the plane equation.

◆ NanPlaneEquation

const ON_PlaneEquation ON_PlaneEquation::NanPlaneEquation
static

(ON_DBL_QNAN,ON_DBL_QNAN,ON_DBL_QNAN,ON_DBL_QNAN)

◆ UnsetPlaneEquation

const ON_PlaneEquation ON_PlaneEquation::UnsetPlaneEquation
static

(ON_UNSET_VALUE,ON_UNSET_VALUE,ON_UNSET_VALUE,ON_UNSET_VALUE)

C++ defaults for construction, destruction, copys, and operator= work fine.

◆ WorldXY

const ON_PlaneEquation ON_PlaneEquation::WorldXY
static

(0,0,1,0)

◆ WorldYZ

const ON_PlaneEquation ON_PlaneEquation::WorldYZ
static

(1,0,0,0)

◆ WorldZX

const ON_PlaneEquation ON_PlaneEquation::WorldZX
static

(0,1,0,0)

◆ x

double ON_PlaneEquation::x

◆ y

double ON_PlaneEquation::y

◆ z

double ON_PlaneEquation::z

◆ ZeroPlaneEquation

const ON_PlaneEquation ON_PlaneEquation::ZeroPlaneEquation
static

(0.0,0.0,0.0,0.0)