![]() |
Open CASCADE Technology Reference Manual 8.0.0
|
Describes a unit vector in the plane (2D space). This unit vector is also called "Direction". See Also gce_MakeDir2d which provides functions for more complex unit vector constructions Geom2d_Direction which provides additional functions for constructing unit vectors and works, in particular, with the parametric equations of unit vectors. More...
#include <gp_Dir2d.hxx>
Public Types | |
| enum class | D { X , Y , NX , NY } |
| Standard directions in 2D space for optimized constexpr construction. More... | |
Public Member Functions | |
| constexpr | gp_Dir2d () noexcept |
| Creates a direction corresponding to X axis. | |
| constexpr | gp_Dir2d (const D theDir) noexcept |
| Creates a direction from a standard direction enumeration. | |
| constexpr | gp_Dir2d (const gp_Vec2d &theV) |
| Normalizes the vector theV and creates a Direction. Raises ConstructionError if theV.Magnitude() <= Resolution from gp. | |
| constexpr | gp_Dir2d (const gp_XY &theCoord) |
| Creates a Direction from a doublet of coordinates. Raises ConstructionError if theCoord.Modulus() <= Resolution from gp. | |
| constexpr | gp_Dir2d (const double theXv, const double theYv) |
| Creates a Direction with its 2 cartesian coordinates. Raises ConstructionError if std::sqrt(theXv*theXv + theYv*theYv) <= Resolution from gp. | |
| constexpr void | SetCoord (const int theIndex, const double theXi) |
| For this unit vector, assigns: the value theXi to: | |
| constexpr void | SetCoord (const double theXv, const double theYv) |
| For this unit vector, assigns: | |
| constexpr void | SetX (const double theX) |
| Assigns the given value to the X coordinate of this unit vector, and then normalizes it. Warning Remember that all the coordinates of a unit vector are implicitly modified when any single one is changed directly. Exceptions Standard_ConstructionError if either of the following is less than or equal to gp::Resolution(): | |
| constexpr void | SetY (const double theY) |
| Assigns the given value to the Y coordinate of this unit vector, and then normalizes it. Warning Remember that all the coordinates of a unit vector are implicitly modified when any single one is changed directly. Exceptions Standard_ConstructionError if either of the following is less than or equal to gp::Resolution(): | |
| constexpr void | SetXY (const gp_XY &theCoord) |
| Assigns: | |
| constexpr double | Coord (const int theIndex) const |
| For this unit vector returns the coordinate of range theIndex : theIndex = 1 => X is returned theIndex = 2 => Y is returned Raises OutOfRange if theIndex != {1, 2}. | |
| constexpr void | Coord (double &theXv, double &theYv) const noexcept |
| For this unit vector returns its two coordinates theXv and theYv. Raises OutOfRange if theIndex != {1, 2}. | |
| constexpr double | X () const noexcept |
| For this unit vector, returns its X coordinate. | |
| constexpr double | Y () const noexcept |
| For this unit vector, returns its Y coordinate. | |
| constexpr const gp_XY & | XY () const noexcept |
| For this unit vector, returns its two coordinates as a number pair. Comparison between Directions The precision value is an input data. | |
| bool | IsEqual (const gp_Dir2d &theOther, const double theAngularTolerance) const |
| Returns True if the two vectors have the same direction i.e. the angle between this unit vector and the unit vector theOther is less than or equal to theAngularTolerance. | |
| bool | IsNormal (const gp_Dir2d &theOther, const double theAngularTolerance) const |
| Returns True if the angle between this unit vector and the unit vector theOther is equal to Pi/2 or -Pi/2 (normal) i.e. std::abs(std::abs(<me>.Angle(theOther)) - PI/2.) <= theAngularTolerance. | |
| bool | IsOpposite (const gp_Dir2d &theOther, const double theAngularTolerance) const |
| Returns True if the angle between this unit vector and the unit vector theOther is equal to Pi or -Pi (opposite). i.e. PI - std::abs(<me>.Angle(theOther)) <= theAngularTolerance. | |
| bool | IsParallel (const gp_Dir2d &theOther, const double theAngularTolerance) const |
| Returns True if the angle between this unit vector and unit vector theOther is equal to 0, Pi or -Pi. i.e. std::abs(Angle(<me>, theOther)) <= theAngularTolerance or PI - std::abs(Angle(<me>, theOther)) <= theAngularTolerance. | |
| double | Angle (const gp_Dir2d &theOther) const |
| Computes the angular value in radians between <me> and <theOther>. Returns the angle in the range [-PI, PI]. | |
| constexpr double | Crossed (const gp_Dir2d &theRight) const noexcept |
| Computes the cross product between two directions. | |
| constexpr double | operator^ (const gp_Dir2d &theRight) const noexcept |
| constexpr double | Dot (const gp_Dir2d &theOther) const noexcept |
| Computes the scalar product. | |
| constexpr double | operator* (const gp_Dir2d &theOther) const noexcept |
| constexpr void | Reverse () noexcept |
| constexpr gp_Dir2d | Reversed () const noexcept |
| Reverses the orientation of a direction. | |
| constexpr gp_Dir2d | operator- () const noexcept |
| void | Mirror (const gp_Dir2d &theV) noexcept |
| gp_Dir2d | Mirrored (const gp_Dir2d &theV) const noexcept |
| Performs the symmetrical transformation of a direction with respect to the direction theV which is the center of the symmetry. | |
| void | Mirror (const gp_Ax2d &theA) noexcept |
| gp_Dir2d | Mirrored (const gp_Ax2d &theA) const noexcept |
| Performs the symmetrical transformation of a direction with respect to an axis placement which is the axis of the symmetry. | |
| void | Rotate (const double Ang) |
| gp_Dir2d | Rotated (const double theAng) const |
| Rotates a direction. theAng is the angular value of the rotation in radians. | |
| void | Transform (const gp_Trsf2d &theT) noexcept |
| gp_Dir2d | Transformed (const gp_Trsf2d &theT) const |
| Transforms a direction with the "Trsf" theT. Warnings : If the scale factor of the "Trsf" theT is negative then the direction <me> is reversed. | |
| void | DumpJson (Standard_OStream &theOStream, int theDepth=-1) const |
| Dumps the content of me into the stream. | |
Describes a unit vector in the plane (2D space). This unit vector is also called "Direction". See Also gce_MakeDir2d which provides functions for more complex unit vector constructions Geom2d_Direction which provides additional functions for constructing unit vectors and works, in particular, with the parametric equations of unit vectors.
|
strong |
Standard directions in 2D space for optimized constexpr construction.
| Enumerator | |
|---|---|
| X | Direction along positive X axis (1, 0) |
| Y | Direction along positive Y axis (0, 1) |
| NX | Direction along negative X axis (-1, 0) |
| NY | Direction along negative Y axis (0, -1) |
|
inlineconstexprnoexcept |
Creates a direction corresponding to X axis.
Creates a direction from a standard direction enumeration.
Normalizes the vector theV and creates a Direction. Raises ConstructionError if theV.Magnitude() <= Resolution from gp.
Creates a Direction from a doublet of coordinates. Raises ConstructionError if theCoord.Modulus() <= Resolution from gp.
Creates a Direction with its 2 cartesian coordinates. Raises ConstructionError if std::sqrt(theXv*theXv + theYv*theYv) <= Resolution from gp.
Computes the angular value in radians between <me> and <theOther>. Returns the angle in the range [-PI, PI].
For this unit vector returns the coordinate of range theIndex : theIndex = 1 => X is returned theIndex = 2 => Y is returned Raises OutOfRange if theIndex != {1, 2}.
For this unit vector returns its two coordinates theXv and theYv. Raises OutOfRange if theIndex != {1, 2}.
Computes the cross product between two directions.
Computes the scalar product.
| void gp_Dir2d::DumpJson | ( | Standard_OStream & | theOStream, |
| int | theDepth = -1 ) const |
Dumps the content of me into the stream.
Returns True if the two vectors have the same direction i.e. the angle between this unit vector and the unit vector theOther is less than or equal to theAngularTolerance.
|
inline |
Returns True if the angle between this unit vector and the unit vector theOther is equal to Pi/2 or -Pi/2 (normal) i.e. std::abs(std::abs(<me>.Angle(theOther)) - PI/2.) <= theAngularTolerance.
|
inline |
Returns True if the angle between this unit vector and the unit vector theOther is equal to Pi or -Pi (opposite). i.e. PI - std::abs(<me>.Angle(theOther)) <= theAngularTolerance.
|
inline |
Returns True if the angle between this unit vector and unit vector theOther is equal to 0, Pi or -Pi. i.e. std::abs(Angle(<me>, theOther)) <= theAngularTolerance or PI - std::abs(Angle(<me>, theOther)) <= theAngularTolerance.
Performs the symmetrical transformation of a direction with respect to an axis placement which is the axis of the symmetry.
Performs the symmetrical transformation of a direction with respect to the direction theV which is the center of the symmetry.
Reverses the orientation of a direction.
Rotates a direction. theAng is the angular value of the rotation in radians.
For this unit vector, assigns:
For this unit vector, assigns: the value theXi to:
Assigns the given value to the X coordinate of this unit vector, and then normalizes it. Warning Remember that all the coordinates of a unit vector are implicitly modified when any single one is changed directly. Exceptions Standard_ConstructionError if either of the following is less than or equal to gp::Resolution():
Assigns:
Assigns the given value to the Y coordinate of this unit vector, and then normalizes it. Warning Remember that all the coordinates of a unit vector are implicitly modified when any single one is changed directly. Exceptions Standard_ConstructionError if either of the following is less than or equal to gp::Resolution():
Transforms a direction with the "Trsf" theT. Warnings : If the scale factor of the "Trsf" theT is negative then the direction <me> is reversed.
For this unit vector, returns its X coordinate.
For this unit vector, returns its two coordinates as a number pair. Comparison between Directions The precision value is an input data.
For this unit vector, returns its Y coordinate.