C3D Toolkit
Kernel - 117958, Vision - 2.7.6.12
|
Local coordinate system in three dimensional space. More...
#include <mb_placement3d.h>
Public Member Functions | |
MbPlacement3D & | Init () |
Initialize identity matrix of a direct transformation (the global coordinate system). | |
MbPlacement3D & | Init (const MbPlacement3D &) |
Initialize by a placement. | |
MbPlacement3D & | Init (const MbMatrix3D &matr) |
Initialize by a matrix. | |
void | Init (const MbCartPoint3D &initOrigin, const MbVector3D &initAxisZ) |
Initialize by point and vector (Z-axis) with arbitrary X-axis. | |
MbPlacement3D & | Init (const MbCartPoint3D &p, const MbVector3D &axisZ, const MbVector3D &axisX, bool left=false) |
Initialize by the origin and vectors of X and Z axes. | |
MbPlacement3D & | Init (const MbCartPoint3D &p, const MbCartPoint3D &axisX, const MbCartPoint3D &axisY, bool left=false) |
Initialize by the origin and points of X and Y axes. | |
MbPlacement3D & | Init (const MbCartPoint3D &p, const MbVector3D &axisZ, bool left) |
Initialize by Z-axis and arbitrary X-axis. | |
MbPlacement3D & | Init (const MbPlacement3D &pl, double distance) |
Initialize by placement with a shift. | |
MbPlacement3D & | Init (const MbCartPoint3D &p, const MbPlacement3D &pl) |
Initialize by origin and orienting placement. | |
MbPlacement3D & | Init (const MbCartPoint3D &org) |
Initialize by origin. | |
MbPlacement3D & | InitXY (const MbCartPoint3D &p, const MbVector3D &axisX, const MbVector3D &axisY, bool reset) |
Initialize by a point and two vectors (X and Y axes). | |
MbPlacement3D & | InitXZ (const MbCartPoint3D &p, const MbVector3D &axisX, const MbVector3D &axisZ) |
Initialize by a point and two vectors (X and Z axes). | |
MbPlacement3D & | InitYZ (const MbCartPoint3D &p, const MbVector3D &axisY, const MbVector3D &axisZ) |
Initialize by a point and two vectors (Y and Z axes). | |
bool | Init (const MbPlacement3D &pl, double ang, const MbCurve3D &c, double t) |
Initialize by curve and angle to plane. | |
bool | Init (const MbCartPoint3D &p, const MbCurve3D &c, double t) |
Initialize by point and curve. | |
bool | Init (const MbCurve3D &, const MbCartPoint3D &, bool checkPlanar) |
Initialize by point, perpendicularly to curve. | |
bool | Init (const MbLine3D &, const MbCartPoint3D &) |
Initialize by a line and a point. | |
bool | Init (const MbLine3D &, const MbVector3D &) |
Initialize by a line and a vector. | |
bool | Init (const MbLine3D &l1, const MbLine3D &l2) |
Initialize by two lines. | |
bool | Init (const MbCurve3D &, double t, bool checkPlanar) |
Initialize perpendicularly to a curve by a parameter on the curve. | |
void | Update (const MbPlacement3D &, VERSION version, bool fuzzy_null=true) |
Bind placement to another coordinates. | |
void | Update (const MbPlacement3D &, const MbPlacement3D &) |
Bind placement to another coordinates. | |
void | UpdateFromNull (VERSION version, bool fuzzy_null=true) |
Bind placement to the local zero. | |
bool | IsSingle () const |
Check coincidence with the global coordinate system (i.e. the direct matrix of a coordinate system is unit). | |
bool | IsTranslation () const |
Check if a coordinate system is translated relative to the global coordinate system. | |
bool | IsRotation () const |
Check if the coordinate system is rotated relative to the global coordinate system. | |
bool | IsLeft () const |
Check if a coordinate system is left. | |
bool | IsRight () const |
Check if a coordinate system is right. | |
bool | IsOrt () const |
Check if a coordinate system is orthogonal, but not normalized. | |
bool | IsOrthogonal () const |
Get orthogonality property of coordinate system. | |
bool | IsAffine () const |
Check if a coordinate system is affine (otherwise it is orthonormalized). | |
bool | IsNormal () const |
Check if coordinate system is orthonormalized. | |
bool | IsUnSet () const |
Check whether bit flags are not set. | |
bool | IsUnit (double eps=Math::lengthEpsilon) const |
Get attribute of the unit placement. | |
bool | IsUnit (double &sqX, double &sqY, double &sqZ, double eps=Math::lengthEpsilon) const |
Get attribute of unit placement and squares of orts. | |
bool | IsTranslationStandard () const |
Check if the axes of a coordinate system are coincident to the standard one (right orthonormalized coordinate system). | |
bool | IsCircular () const |
Check if a coordinate system is orthogonal with axes X and Y of equal length (circle moves to circle). | |
bool | IsCircular (double &lxy) const |
Check if a coordinate system is orthogonal with axes X and Y of equal length (circle moves to circle). | |
bool | IsIsotropic () const |
Check if a coordinate system is orthogonal with axes X and Y of equal length. | |
bool | IsIsotropic (double &l) const |
Check if a coordinate system is orthogonal with axes X and Y of equal length. | |
const MbCartPoint3D & | GetOrigin () const |
Get the origin of a coordinate system. | |
const MbVector3D & | GetAxisZ () const |
Get the Z-axis. | |
const MbVector3D & | GetAxisX () const |
Get the X-axis. | |
const MbVector3D & | GetAxisY () const |
Get the Y-axis. | |
MbCartPoint3D & | SetOrigin () |
Get the origin of a local coordinate system. | |
MbVector3D & | SetAxisZ () |
Get the Z-axis. | |
MbVector3D & | SetAxisX () |
Get the X-axis. | |
MbVector3D & | SetAxisY () |
Get the Y-axis. | |
void | SetOrigin (const MbCartPoint3D &o) |
Set the origin of a local coordinate system. | |
void | SetAxisZ (const MbVector3D &a) |
Set the Z-axis. | |
void | SetAxisX (const MbVector3D &a) |
Set the X-axis. | |
void | SetAxisY (const MbVector3D &a) |
Set the Y-axis. | |
void | AxisZInvert () |
Invert the Z-axis. | |
void | AxisXInvert () |
Invert the X-axis. | |
void | AxisYInvert () |
Invert the Y-axis. | |
void | SetFlag (bool bLeft, bool bAffine=false, bool bOrt=true) const |
Set the flag of state. | |
void | SetRight () |
Set the coordinate system as right. | |
MbPlacement3D & | Transform (const MbMatrix3D &) |
Transform according to the matrix. | |
MbPlacement3D & | Move (const MbVector3D &) |
Translate along a vector. | |
MbPlacement3D & | Rotate (const MbAxis3D &axis, double angle) |
Rotate at a given angle around an axis. | |
MbPlacement3D & | Scale (double sx, double sy, double sz) |
Scale. | |
MbPlacement3D & | Scale (double s) |
Scale. | |
bool | IsSame (const MbPlacement3D &other, double accuracy) const |
Determine whether an object is equal? | |
void | GetMatrixInto (MbMatrix3D &) const |
Get the matrix of transformation to the local coordinate system: r=R*into (inverse matrix). | |
MbMatrix3D | GetMatrixInto () const |
Get the matrix of transformation to the local coordinate system: r=R*into (inverse matrix). | |
void | GetMatrixFrom (MbMatrix3D &) const |
Get the matrix of transformation from the local coordinate system: R=r*from (direct matrix). | |
MbMatrix3D | GetMatrixFrom () const |
Get the matrix of transformation from the local coordinate system: R=r*from (direct matrix). | |
void | Symmetry (MbMatrix3D &) const |
Get the matrix of symmetry with respect to the XY-plane. | |
bool | GetMatrixToPlace (const MbPlacement3D &p, MbMatrix &matr, double eps=Math::angleRegion) const |
Get the matrix of transformation to place. | |
void | GetMatrixToPlace (const MbPlacement3D &p, MbMatrix3D &matr) const |
Get the matrix of transformation to place. | |
double | DistanceToPoint (const MbCartPoint3D &to) const |
Calculate the distance to a point. | |
void | PointProjection (const MbCartPoint3D &p, MbCartPoint3D &pOn) const |
Find point projection to XY-plane. | |
void | VectorProjection (const MbVector3D &v, double &x, double &y) const |
Find the vector of projection to XY-plane. | |
void | PointProjection (const MbCartPoint3D &p, double &x, double &y) const |
Find the point projection to XY-plane. | |
bool | DirectPointProjection (const MbCartPoint3D &p, const MbVector3D &v, double &x, double &y) const |
Find the point projection to XY-plane along a vector in either of two directions. | |
bool | NearDirectPointProjection (const MbCartPoint3D &p, const MbVector3D &v, double &x, double &y, bool onlyPositiveDirection) const |
Find the point projection to XY-plane in direction of the vector. | |
void | PointOn (double x, double y, MbCartPoint3D &p) const |
Get the projection of a point on XY-plane. | |
void | PointOn (const MbCartPoint &r, MbCartPoint3D &p) const |
Get the space point by a point on XY-plane. | |
void | VectorOn (const MbVector &r, MbVector3D &p) const |
Get the space vector by a vector on XY-plane. | |
void | VectorOn (const MbDirection &r, MbVector3D &p) const |
Get the space vector by a vector on XY-plane. | |
void | Normal (MbVector3D &n) const |
Get the normal of the plane XY of a local coordinate system, the Z axis is not taken into account here. | |
MbVector3D | Normal () const |
Get the normal of the plane XY of a local coordinate system, the Z axis is not taken into account here. | |
MbeItemLocation | PointRelative (const MbCartPoint3D &pnt, double eps=ANGLE_REGION) const |
Get point location relative to the plane. | |
MbeItemLocation | CubeRelative (const MbCube &cube, double eps=ANGLE_REGION) const |
Get bounding box location relative to the plane. | |
bool | Colinear (const MbPlacement3D &with, double eps=Math::angleRegion) const |
Check collinearity. | |
bool | NormalColinear (const MbPlacement3D &with, double eps=Math::angleRegion) const |
Check collinearity of normals. | |
bool | Complanar (const MbPlacement3D &with, double eps=Math::angleRegion) const |
Check complanarity. | |
bool | Orthogonal (const MbAxis3D &, double &x, double &y, double eps=Math::angleRegion) const |
Check orthogonality. | |
void | AdaptToPlace (const MbPlacement3D &) |
Match with the place by rotation till the parallelism and translation along place normal. | |
double | Angle (const MbVector3D &v) const |
Angle to Z-axis. | |
double | Angle (const MbPlacement3D &) const |
Angle between Z-axes of the placements. | |
double | GetNormalAngle (const MbVector3D &) const |
Get the sine of angle between a vector and the plane. | |
void | Reset () |
Recalculate the coordinate system for changed internal data. | |
void | Invert (MbMatrix *=nullptr) |
Invert. | |
bool | LineIntersectionPoint (const MbCartPoint3D &origin, const MbVector3D &direction, MbCartPoint3D &p, double &d, double eps=ANGLE_EPSILON) const |
Find the nearest point of intersection with line. More... | |
bool | PlanesIntersection (const MbPlacement3D &place, MbCartPoint3D &p, MbVector3D &axis, double eps=ANGLE_EPSILON) const |
Get the point and direction of planes intersection line. | |
MbeNewtonResult | CurveIntersectNewton (const MbCurve3D &curve, bool ext, double funcEpsilon, size_t iterLimit, double &u, double &v, double &t) const |
Intersection plane XY with a curve. | |
MbeNewtonResult | NearestPoints (const MbCurve3D &curve, bool ext, double &u0, double &v0, double &t0, double &dmin, bool tCalc) const |
Calculate parameters of the nearest points of surface and curve. | |
void | TransformPoint (const MbMatrix3D &, MbCartPoint &) const |
Transform 2D-point to another 2D-point. | |
double | GetXEpsilon () const |
Give the minimum distinguishable value of U parameter. | |
double | GetYEpsilon () const |
Get the minimum distinguishable value of V parameter. | |
bool | SetRoundedValue (bool total, double eps) |
Round. | |
bool | operator== (const MbPlacement3D &) const |
Check for equality. | |
bool | operator!= (const MbPlacement3D &) const |
Check for inequality. | |
void | operator= (const MbPlacement3D &) |
Assign another coordinate system. | |
MbPlacement3D | operator* (const MbPlacement3D &p) const |
Multiply by a local coordinate system: P = this * p (as of matrix multiplication). | |
void | Normalize () |
Orthogonalize and normalize axes of a local coordinate system. | |
bool | IsShift (const MbPlacement3D &, MbVector3D &, bool &isSame, double accuracy=LENGTH_EPSILON) const |
Check if the object is a translation. | |
bool | IsShiftZ (const MbPlacement3D &other, MbVector3D &vect, double accuracy) const |
Check if the object is a shift of the current one along axis Z? | |
bool | IsDegenerate (double lenEps=Math::metricRegion, double angEps=Math::angleRegion) const |
Check for degeneracy. | |
void | GetPointFrom (double x0, double y0, double z0, MbCartPoint3D &p, MbeLocalSystemType3D type=ls_CartesianSystem) const |
Get the point in the global coordinate system by local coordinates. | |
void | GetVectorFrom (double x1, double y1, double z1, MbVector3D &v, MbeLocalSystemType3D type=ls_CartesianSystem) const |
Get the vector in the global coordinate system by local coordinates. | |
void | GetPointFrom (MbCartPoint3D &p, MbeLocalSystemType3D type=ls_CartesianSystem) const |
Transform a point from a local coordinate system to the global coordinate system. | |
void | GetVectorFrom (MbVector3D &v, MbeLocalSystemType3D type=ls_CartesianSystem) const |
Transform a vector from a local coordinate system to the global coordinate system. | |
void | GetPointInto (MbCartPoint3D &p, MbeLocalSystemType3D type=ls_CartesianSystem) const |
Transform a point from the global coordinate system to a local coordinate system. | |
void | GetVectorInto (MbVector3D &v, MbeLocalSystemType3D type=ls_CartesianSystem) const |
Transform a vector from the global coordinate system to a local coordinate system. | |
void | GetPointAndDerivesFrom (MbCartPoint3D &point, MbVector3D &firstDer, MbVector3D &secondDer, MbVector3D &thirdDer, MbeLocalSystemType3D type=ls_CartesianSystem) const |
Transform a point and the first three derivatives from a local coordinate system to the global coordinate system. | |
void | GetPointAndDerivesInto (MbCartPoint3D &point, MbVector3D &firstDer, MbVector3D &secondDer, MbVector3D &thirdDer, MbeLocalSystemType3D type=ls_CartesianSystem) const |
Transform a point and the first three derivatives from the global coordinate system to a local coordinate system. | |
void | GetProperties (MbProperties &) |
Get properties of the object. | |
void | SetProperties (const MbProperties &) |
Set properties of the object. | |
The constructors. | |
MbPlacement3D () | |
Default constructor. | |
MbPlacement3D (const MbCartPoint3D &org) | |
Constructor by point. | |
MbPlacement3D (const MbVector3D &axisX, const MbVector3D &axisY, const MbCartPoint3D &org) | |
Constructor by point and two vectors. | |
MbPlacement3D (const MbPlacement3D &place) | |
Copy-constructor. | |
MbPlacement3D (const MbMatrix3D &matr) | |
Constructor by matrix. | |
MbPlacement3D (const MbCartPoint3D &org, const MbVector3D &axisZ, const MbVector3D &axisX, bool l=false) | |
Constructor by point and two vectors. | |
MbPlacement3D (const MbCartPoint3D &org, const MbCartPoint3D &px, const MbCartPoint3D &py, bool l=false) | |
Constructor by three points. | |
MbPlacement3D (const MbCartPoint3D &org, const MbVector3D &axisZ, bool l=false) | |
Constructor by point and vector (Z-axis) with arbitrary X-axis. | |
Static Public Attributes | |
static const MbPlacement3D | global |
A constant of the global coordinate system. | |
Local coordinate system in three dimensional space.
Local coordinate system in three dimensional space.
Local coordinate system is described by the initial point and three non-parallel vectors. In most cases the system of coordinates is right, and vectors of system are orthonormalized. A coordinate system can become left and not orthonormalized via transformations. Local coordinate system is Cartesian. A point is defined by three coordinates x, y, z in the Cartesian coordinate system.
A local coordinate system may act both as a cylindrical or a sphricial coordinate system.
A point in a cylindrical coordinate system is defined by three coordinates r, f, z:
r, f - polar coordinates of point projection to the main plane;
r - length of radius-vector projection;
f - polar angle of radius-vector projection;
z - z-axis (the distance from point to the main plane).
When a local coordinate system is used as a cylindrical coordinate system, it is considered that:
the origin of a cylindrical coordinate system is coincident to the origin of Cartesian coordinate system;
Oz-axis of a cylindrical coordinate system is coincident to Oz-axis of the Cartesian coordinate system;
the main plane of a cylindrical coordinate system is coincident to Oxy-plane of the Cartesian coordinate system;
the polar axis of a cylindrical coordinate system is coincident to Ox-axis of the Cartesian coordinate system;
the polar angle f of a cylindrical coordinate system is counted from Ox-axis to the positive direction of Oy-axis.
A point in a spherical coordinate system is defined by three coordinates r, f, w:
r - distance from the origin to a point (length of radius-vector);
f - the angle between radius-vector projection to the plane and a ray on the plane (longitude);
w - the angle between radius-vector and the normal of spherical coordinate system plane (polar distance).
When a local coordinate system is used as a spherical coordinate system, it is considered that:
the origin of a spherical coordinate system is coincident to the origin of the Cartesian coordinate system;
the ray perpendicular to the plane of a spherical coordinate system is coincident to Oz-axis of the Cartesian coordinate system;
the plane of a spherical coordinate system is coincident to Oxy-plane of the Cartesian coordinate system;
the angle f of a spherical coordinate system is counted from Ox-axis to the positive direction of Oy-axis.
To speed up transformation of coordinates the local coordinate system has additional data - flag of state.
Use Get... methods to obtain data of a coordinate system from the outside.
To modify data of a coordinate system from the outside use Set... methods that automatically reset the flag of the system to the unspecified state.