#include <opennurbs_plane.h>

Public Member Functions

 ON_Plane ()
 The default constructor creates a plane with orgin=(0,0,0), xaxis=(1,0,0), yaxis=(0,1,0) zaxis=(0,0,1), and equation=(0,0,1,0). More...
 
 ON_Plane (const ON_3dPoint &origin, const ON_3dVector &normal)
 Construct a plane from a point and normal vector. More...
 
 ON_Plane (const ON_3dPoint &origin, const ON_3dVector &x_dir, const ON_3dVector &y_dir)
 Construct a plane from a point, and two vectors in the plane. More...
 
 ON_Plane (const ON_3dPoint &origin, const ON_3dPoint &x_point, const ON_3dPoint &y_point)
 Construct a plane from three non-collinear points. More...
 
 ON_Plane (const double equation[4])
 Construct a plane from an equation. More...
 
 ON_Plane (const ON_PlaneEquation &plane_equation)
 
 ~ON_Plane ()
 
bool ClosestPointTo (ON_3dPoint world_point, double *u, double *v) const
 Get point on plane that is closest to a given point. More...
 
ON_3dPoint ClosestPointTo (ON_3dPoint point) const
 Get point on plane that is closest to a given point. More...
 
bool CreateFromEquation (const double equation[4])
 Construct a plane from an equation. More...
 
bool CreateFromEquation (const class ON_PlaneEquation &plane_equation)
 
bool CreateFromFrame (const ON_3dPoint &origin, const ON_3dVector &x_dir, const ON_3dVector &y_dir)
 Construct a plane from a point, and two vectors in the plane. More...
 
bool CreateFromNormal (const ON_3dPoint &origin, const ON_3dVector &normal)
 Create a plane from a point and normal vector. More...
 
bool CreateFromPoints (const ON_3dPoint &origin, const ON_3dPoint &point_on_x, const ON_3dPoint &point_on)
 Construct a plane from three non-collinear points. More...
 
double DistanceTo (const ON_3dPoint &point) const
 Get signed distance from the plane to a point. More...
 
bool Flip ()
 Flip plane orientation by swapping x and y axes, reversing the zaxis, and updating the equation. More...
 
bool GetDistanceToBoundingBox (const ON_BoundingBox &, double *min, double *max) const
 
ON_Line IsoLine (int dir, double c) const
 Get an isoparameteric line on the plane. More...
 
bool IsValid () const
 Test plane to see if it is valid. More...
 
const ON_3dVectorNormal () const
 
bool operator!= (const ON_Plane &) const
 
bool operator== (const ON_Plane &) const
 
const ON_3dPointOrigin () const
 
ON_3dPoint PointAt (double u, double v) const
 Evaluate a point on the plane More...
 
ON_3dPoint PointAt (double u, double v, double w) const
 Evaluate a point on the plane More...
 
bool Rotate (double sin_angle, double cos_angle, const ON_3dVector &axis)
 Rotate a plane about its origin. More...
 
bool Rotate (double angle, const ON_3dVector &axis)
 Rotate a plane about its origin. More...
 
bool Rotate (double sin_angle, double cos_angle, const ON_3dVector &axis, const ON_3dPoint &center)
 Rotate a plane about a point. More...
 
bool Rotate (double angle, const ON_3dVector &axis, const ON_3dPoint &center)
 Rotate a plane about a point. More...
 
void SetOrigin (const ON_3dPoint &origin)
 Set the origin and update the plane equation More...
 
bool SwapCoordinates (int i, int j)
 Transform a plane by swapping coordinates. More...
 
bool Transform (const ON_Xform &xform)
 For intersections see ON_Intersect();. More...
 
bool Translate (const ON_3dVector &delta)
 Translate a plane. More...
 
bool UpdateEquation ()
 Update the plane equation based on the current values of the origin and zaxis. More...
 
const ON_3dVectorXaxis () const
 
const ON_3dVectorYaxis () const
 

Static Public Member Functions

static ON_Plane FromPointList (size_t point_list_count, const ON_3dPoint *point_list)
 
static ON_Plane FromPointList (const ON_SimpleArray< ON_3dPoint > &point_list)
 
static ON_Plane FromPointList (size_t point_list_count, const ON_3fPoint *point_list)
 
static ON_Plane FromPointList (const ON_SimpleArray< ON_3fPoint > &point_list)
 
static ON_Plane FromPointList (const class ON_3dPointListRef &point_list)
 
static ON_Plane FromPointList (size_t point_index_count, const unsigned int *point_index_list, const class ON_3dPointListRef &point_list)
 
static ON_Plane FromPointList (size_t point_index_count, size_t point_index_stride, const unsigned int *point_index_list, const class ON_3dPointListRef &point_list)
 

Public Attributes

ON_3dPoint origin
 origin of plane More...
 
ON_PlaneEquation plane_equation
 equation of plane More...
 
ON_3dVector xaxis
 unit X axis of plane More...
 
ON_3dVector yaxis
 unit Y axis of plane More...
 
ON_3dVector zaxis
 unit Z axis of plane More...
 

Static Public Attributes

static const ON_Plane UnsetPlane
 All values are ON_UNSET_VALUE. More...
 
static const ON_Plane World_xy
 world plane coordinate system ON_Plane(ON_3dPoint::Origin, ON_3dVector::XAxis, ON_3dVector::YAxis); More...
 

Constructor & Destructor Documentation

◆ ON_Plane() [1/6]

ON_Plane::ON_Plane ( )

The default constructor creates a plane with orgin=(0,0,0), xaxis=(1,0,0), yaxis=(0,1,0) zaxis=(0,0,1), and equation=(0,0,1,0).

◆ ON_Plane() [2/6]

ON_Plane::ON_Plane ( const ON_3dPoint origin,
const ON_3dVector normal 
)

Construct a plane from a point and normal vector.

Parameters
origin[in] point on the plane
normal[in] non-zero normal to the plane

origin = point, zaxis = unitized normal, xaxis xaxis set with xaxis.PerpindicularTo(zaxis).

See also
ON_Plane::CreateFromNormal

◆ ON_Plane() [3/6]

ON_Plane::ON_Plane ( const ON_3dPoint origin,
const ON_3dVector x_dir,
const ON_3dVector y_dir 
)

Construct a plane from a point, and two vectors in the plane.

Parameters
origin[in] point on the plane
x_dir[in] non-zero vector in the plane that determines the xaxis direction.
y_dir[in] non-zero vector not parallel to x_dir that is used to determine the yaxis direction. y_dir does not have to be perpendicular to x_dir.

◆ ON_Plane() [4/6]

ON_Plane::ON_Plane ( const ON_3dPoint origin,
const ON_3dPoint x_point,
const ON_3dPoint y_point 
)

Construct a plane from three non-collinear points.

Parameters
origin[in] point on the plane
x_point[in] second point in the plane. The xaxis will be parallel to x_point-origin.
y_point[in] third point on the plane that is not collinear with the first two points. yaxis*(y_point-origin) will be > 0.

◆ ON_Plane() [5/6]

ON_Plane::ON_Plane ( const double  equation[4])

Construct a plane from an equation.

Parameters
equation[in] an array of 4 doubles with one of equation[0], equation[1], or equation[2] being non-zero.

◆ ON_Plane() [6/6]

ON_Plane::ON_Plane ( const ON_PlaneEquation plane_equation)

◆ ~ON_Plane()

ON_Plane::~ON_Plane ( )

Member Function Documentation

◆ ClosestPointTo() [1/2]

bool ON_Plane::ClosestPointTo ( ON_3dPoint  world_point,
double *  u,
double *  v 
) const

Get point on plane that is closest to a given point.

Parameters
world_point[in] 3d point
u[out]
v[out] The point ON_Plane::PointAt(*u,*v) is the point on the plane that is closest to world_point.
Returns
true if successful.

◆ ClosestPointTo() [2/2]

ON_3dPoint ON_Plane::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 world_point.

◆ CreateFromEquation() [1/2]

bool ON_Plane::CreateFromEquation ( const double  equation[4])

Construct a plane from an equation.

Parameters
equation[in] an array of 4 doubles with one of equation[0], equation[1], or equation[2] being non-zero.
Returns
true if valid plane is created.

points on the plane will satisfy x*equation[0] +y*equation[1] + z*equation[2] + equation[3] = 0

◆ CreateFromEquation() [2/2]

bool ON_Plane::CreateFromEquation ( const class ON_PlaneEquation plane_equation)

◆ CreateFromFrame()

bool ON_Plane::CreateFromFrame ( const ON_3dPoint origin,
const ON_3dVector x_dir,
const ON_3dVector y_dir 
)

Construct a plane from a point, and two vectors in the plane.

Parameters
origin[in] point on the plane
x_dir[in] non-zero vector in the plane that determines the xaxis direction.
y_dir[in] non-zero vector not parallel to x_dir that is used to determine the yaxis direction. y_dir does not have to be perpendicular to x_dir.
Returns
true if valid plane is created.

◆ CreateFromNormal()

bool ON_Plane::CreateFromNormal ( const ON_3dPoint origin,
const ON_3dVector normal 
)

Create a plane from a point and normal vector.

Parameters
origin[in] point on the plane
normal[in] non-zero normal to the plane
Returns
true if valid plane is created.

origin = point, zaxis = unitized normal, xaxis xaxis set with xaxis.PerpindicularTo(zaxis).

◆ CreateFromPoints()

bool ON_Plane::CreateFromPoints ( const ON_3dPoint origin,
const ON_3dPoint point_on_x,
const ON_3dPoint point_on 
)

Construct a plane from three non-collinear points.

Parameters
origin[in] point on the plane
point_on_x[in] second point in the plane. The xaxis will be parallel to x_point-origin.
point_on[in] third point on the plane that is not collinear with the first two points. yaxis*(y_point-origin) will be > 0.
Returns
true if valid plane is created.

◆ DistanceTo()

double ON_Plane::DistanceTo ( const ON_3dPoint point) const

Get signed distance from the plane to a point.

Parameters
point[in]
Returns
Signed distance from a point to a plane.

If the point is on the plane, the distance is 0. If the point is above the plane, the distance is > 0. If the point is below the plane the distance is < 0. The zaxis determines the plane's orientation.

◆ Flip()

bool ON_Plane::Flip ( )

Flip plane orientation by swapping x and y axes, reversing the zaxis, and updating the equation.

Returns
true if successful

◆ FromPointList() [1/7]

static ON_Plane ON_Plane::FromPointList ( size_t  point_list_count,
const ON_3dPoint point_list 
)
static
Returns
ON_Plane::UnsetPlane if input is not valid.

◆ FromPointList() [2/7]

static ON_Plane ON_Plane::FromPointList ( const ON_SimpleArray< ON_3dPoint > &  point_list)
static
Returns
ON_Plane::UnsetPlane if input is not valid.

◆ FromPointList() [3/7]

static ON_Plane ON_Plane::FromPointList ( size_t  point_list_count,
const ON_3fPoint point_list 
)
static
Returns
ON_Plane::UnsetPlane if input is not valid.

◆ FromPointList() [4/7]

static ON_Plane ON_Plane::FromPointList ( const ON_SimpleArray< ON_3fPoint > &  point_list)
static
Returns
ON_Plane::UnsetPlane if input is not valid.

◆ FromPointList() [5/7]

static ON_Plane ON_Plane::FromPointList ( const class ON_3dPointListRef point_list)
static
Returns
ON_Plane::UnsetPlane if input is not valid.

◆ FromPointList() [6/7]

static ON_Plane ON_Plane::FromPointList ( size_t  point_index_count,
const unsigned int *  point_index_list,
const class ON_3dPointListRef point_list 
)
static
Returns
ON_Plane::UnsetPlane if input is not valid.

◆ FromPointList() [7/7]

static ON_Plane ON_Plane::FromPointList ( size_t  point_index_count,
size_t  point_index_stride,
const unsigned int *  point_index_list,
const class ON_3dPointListRef point_list 
)
static

◆ GetDistanceToBoundingBox()

bool ON_Plane::GetDistanceToBoundingBox ( const ON_BoundingBox ,
double *  min,
double *  max 
) const

◆ IsoLine()

ON_Line ON_Plane::IsoLine ( int  dir,
double  c 
) const

Get an isoparameteric line on the plane.

Parameters
dir[in] direction of iso-parametric line 0: first parameter varies and second parameter is constant e.g., line(t) = plane(t,c) 1: first parameter is constant and second parameter varies e.g., line(t) = plane(c,t)
c[in] value of constant parameter
Returns
iso-parametric line

◆ IsValid()

bool ON_Plane::IsValid ( ) const

Test plane to see if it is valid.

Returns
true if all fields contain reasonable information and equation jibes with point and zaxis.

◆ Normal()

const ON_3dVector& ON_Plane::Normal ( ) const
Returns
Plane unit normal.

◆ operator!=()

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

◆ operator==()

bool ON_Plane::operator== ( const ON_Plane ) const

◆ Origin()

const ON_3dPoint& ON_Plane::Origin ( ) const
Returns
Plane origin.

◆ PointAt() [1/2]

ON_3dPoint ON_Plane::PointAt ( double  u,
double  v 
) const

Evaluate a point on the plane

Parameters
u[in]
v[in] evaulation parameters
Returns
plane.origin + u*plane.xaxis + v*plane.yaxis

◆ PointAt() [2/2]

ON_3dPoint ON_Plane::PointAt ( double  u,
double  v,
double  w 
) const

Evaluate a point on the plane

Parameters
u[in]
v[in] evaluation parameters
w[in] elevation parameter
Returns
plane.origin + u*plane.xaxis + v*plane.yaxis + z*plane.zaxis

◆ Rotate() [1/4]

bool ON_Plane::Rotate ( double  sin_angle,
double  cos_angle,
const ON_3dVector axis 
)

Rotate a plane about its origin.

Parameters
sin_angle[in] sine of rotation angle
cos_angle[in] cosine of rotation angle
axis[in] axis of rotation
Returns
true if successful

◆ Rotate() [2/4]

bool ON_Plane::Rotate ( double  angle,
const ON_3dVector axis 
)

Rotate a plane about its origin.

Parameters
angle[in] rotation angle in radians
axis[in] axis of rotation
Returns
true if successful

◆ Rotate() [3/4]

bool ON_Plane::Rotate ( double  sin_angle,
double  cos_angle,
const ON_3dVector axis,
const ON_3dPoint center 
)

Rotate a plane about a point.

Parameters
sin_angle[in] sine of rotation angle
cos_angle[in] cosine of rotation angle
axis[in] axis of rotation
center[in] center of rotation
Returns
true if successful

◆ Rotate() [4/4]

bool ON_Plane::Rotate ( double  angle,
const ON_3dVector axis,
const ON_3dPoint center 
)

Rotate a plane about a point.

Parameters
angle[in] rotation angle in radians
axis[in] axis of rotation
center[in] center of rotation
Returns
true if successful

◆ SetOrigin()

void ON_Plane::SetOrigin ( const ON_3dPoint origin)

Set the origin and update the plane equation

Parameters
origin[in] the new origin

◆ SwapCoordinates()

bool ON_Plane::SwapCoordinates ( int  i,
int  j 
)

Transform a plane by swapping coordinates.

Parameters
i[in]
j[in] indices of coordinates to swap. 0 = x coordinate, 1 = y coordinate, 2 = z coordinate.
Returns
true if successful.

◆ Transform()

bool ON_Plane::Transform ( const ON_Xform xform)

For intersections see ON_Intersect();.

Transform plane.

Parameters
xform[in] transformation to apply to plane
Returns
true if successful

◆ Translate()

bool ON_Plane::Translate ( const ON_3dVector delta)

Translate a plane.

Parameters
delta[in] translation vector
Returns
true if successful

◆ UpdateEquation()

bool ON_Plane::UpdateEquation ( )

Update the plane equation based on the current values of the origin and zaxis.

Returns
true if successful. false if zaxis is zero.

If you modify a plane's origin or zaxis, call UpdateEquation() to set equation[].

◆ Xaxis()

const ON_3dVector& ON_Plane::Xaxis ( ) const
Returns
Plane unit x-axis.

◆ Yaxis()

const ON_3dVector& ON_Plane::Yaxis ( ) const
Returns
Plane unit y-axis.

Member Data Documentation

◆ origin

ON_3dPoint ON_Plane::origin

origin of plane

◆ plane_equation

ON_PlaneEquation ON_Plane::plane_equation

equation of plane

◆ UnsetPlane

const ON_Plane ON_Plane::UnsetPlane
static

All values are ON_UNSET_VALUE.

◆ World_xy

const ON_Plane ON_Plane::World_xy
static

◆ xaxis

ON_3dVector ON_Plane::xaxis

unit X axis of plane

◆ yaxis

ON_3dVector ON_Plane::yaxis

unit Y axis of plane

◆ zaxis

ON_3dVector ON_Plane::zaxis

unit Z axis of plane