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. More...

#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
 Get point on plane that is closest to a given point. More...
 
bool Create (ON_3dPoint P, ON_3dVector N)
 Sets (x,y,z) to a unitized N and then sets d = -(x*P.x + y*P.y + z*P.z). More...
 
ON_3dVector Direction () const
 
double DirectionLength () 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
 Test points on a bezier curve to see if they are near the plane. More...
 
int IsParallelTo (const ON_PlaneEquation &other, double angle_tolerance=ON_DEFAULT_ANGLE_TOLERANCE) const
 
bool IsSet () const
 returns true if x, y, z, d are valid, finite doubles and at least one of x, y or z is not zero. More...
 
bool IsValid () const
 returns true if x, y, z, d are valid, finite doubles. More...
 
double MaximumAbsoluteValueAt (bool bRational, int point_count, int point_stride, const double *points, double stop_value) const
 Get the maximum absolute value of the plane equation on a set of 3d points. More...
 
double MaximumCoefficient () const
 
double MaximumValueAt (const ON_BoundingBox &bbox) const
 Get the maximum value of the plane equation on a bounding box. More...
 
double MaximumValueAt (bool bRational, int point_count, int point_stride, const double *points, double stop_value) const
 Get the maximum value of the plane equation on a set of 3d points. More...
 
double MinimumValueAt (const ON_BoundingBox &bbox) const
 Get the minimum value of the plane equation on a bounding box. More...
 
double MinimumValueAt (bool bRational, int point_count, int point_stride, const double *points, double stop_value) const
 Get the minimum value of the plane equation on a set of 3d points. More...
 
ON_PlaneEquation NegatedPlaneEquation () const
 
bool operator!= (const ON_PlaneEquation &) const
 
bool operator== (const ON_PlaneEquation &) const
 
double & operator[] (int)
 
double & operator[] (unsigned int)
 
double operator[] (int) const
 
double operator[] (unsigned int) const
 
bool Transform (const ON_Xform &xform)
 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). More...
 
ON_PlaneEquation UnitizedPlaneEquation () const
 
ON_3dVector UnitNormal () const
 
double ValueAt (ON_3dPoint P) const
 Evaluate the plane at a point. More...
 
double ValueAt (ON_4dPoint P) const
 
double ValueAt (ON_3dVector P) const
 
double ValueAt (double x, double y, double z) const
 
double * ValueAt (int Pcount, const ON_3fPoint *P, double *value, double value_range[2]) const
 Evaluate the plane at a list of point values. More...
 
double * ValueAt (int Pcount, const ON_3dPoint *P, double *value, double value_range[2]) const
 
ON_Interval ValueRange (size_t point_list_count, const ON_3dPoint *point_list) const
 
ON_Interval ValueRange (const ON_SimpleArray< ON_3dPoint > &point_list) const
 
ON_Interval ValueRange (size_t point_list_count, const ON_3fPoint *point_list) const
 
ON_Interval ValueRange (const ON_SimpleArray< ON_3fPoint > &point_list) const
 
ON_Interval ValueRange (const class ON_3dPointListRef &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
 
double ZeroTolerance () const
 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. More...
 

Static Public Member Functions

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

Public Attributes

double d
 
double x
 
double y
 
double z
 

Static Public Attributes

static const ON_PlaneEquation UnsetPlaneEquation
 
static const ON_PlaneEquation ZeroPlaneEquation
 

Detailed 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

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 
)

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.

◆ Direction()

ON_3dVector ON_PlaneEquation::Direction ( ) const
Returns
Direction (x,y,z)

◆ DirectionLength()

double ON_PlaneEquation::DirectionLength ( ) 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

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

◆ IsSet()

bool ON_PlaneEquation::IsSet ( ) const

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

◆ IsValid()

bool ON_PlaneEquation::IsValid ( ) const

returns true if x, y, z, d are valid, finite doubles.

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

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]
ith 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/2]

double ON_PlaneEquation::MaximumValueAt ( const ON_BoundingBox bbox) const

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() [2/2]

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

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]
ith 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() [1/2]

double ON_PlaneEquation::MinimumValueAt ( const ON_BoundingBox bbox) const

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() [2/2]

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

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]
ith 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.

◆ 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  )

◆ operator[]() [2/4]

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

◆ operator[]() [3/4]

double ON_PlaneEquation::operator[] ( int  ) const

◆ 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)

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.

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 ( ON_3dPoint  P) const

Evaluate the plane at a point.

Parameters
P[in]
Returns
x*P.x + y*P.y + z*P.z + d;

◆ ValueAt() [2/6]

double ON_PlaneEquation::ValueAt ( ON_4dPoint  P) const

◆ ValueAt() [3/6]

double ON_PlaneEquation::ValueAt ( ON_3dVector  P) const

◆ ValueAt() [4/6]

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

◆ ValueAt() [5/6]

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

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() [6/6]

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

◆ ValueRange() [1/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() [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 ( size_t  point_list_count,
const ON_3fPoint point_list 
) const
Returns
ON_Interval::EmptyInterval if input is not valid.

◆ ValueRange() [4/7]

ON_Interval ON_PlaneEquation::ValueRange ( const ON_SimpleArray< ON_3fPoint > &  point_list) const
Returns
ON_Interval::EmptyInterval if input is not valid.

◆ ValueRange() [5/7]

ON_Interval ON_PlaneEquation::ValueRange ( const class ON_3dPointListRef point_list) const
Returns
ON_Interval::EmptyInterval if input is not valid.

◆ ValueRange() [6/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() [7/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

◆ ZeroTolerance()

double ON_PlaneEquation::ZeroTolerance ( ) const

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

◆ UnsetPlaneEquation

const ON_PlaneEquation ON_PlaneEquation::UnsetPlaneEquation
static

◆ x

double ON_PlaneEquation::x

◆ y

double ON_PlaneEquation::y

◆ z

double ON_PlaneEquation::z

◆ ZeroPlaneEquation

const ON_PlaneEquation ON_PlaneEquation::ZeroPlaneEquation
static