AnyCAD Rapid API 2026
Help you to create a better world!
载入中...
搜索中...
未找到
AnyCAD.Foundation.GDir2d类 参考

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 更多...

类 AnyCAD.Foundation.GDir2d 继承关系图:

Public 成员函数

 GDir2d (global::System.IntPtr cPtr, bool cMemoryOwn)
 仅供内部使用
 
void Dispose ()
 
 GDir2d ()
 Creates a direction corresponding to X axis.
 
 GDir2d (GVec2d theV)
 Normalizes the vector theV and creates a Direction. Raises ConstructionError if theV.Magnitude() <= Resolution from gp.
 
 GDir2d (GXY theCoord)
 Creates a Direction from a doublet of coordinates. Raises ConstructionError if theCoord.Modulus() <= Resolution from gp.
 
 GDir2d (double theXv, double theYv)
 Creates a Direction with its 2 cartesian coordinates. Raises ConstructionError if Sqrt(theXv*theXv + theYv*theYv) <= Resolution from gp.
 
void SetCoord (int theIndex, double theXi)
 For this unit vector, assigns: the value theXi to: - the X coordinate if theIndex is 1, or - the Y coordinate if theIndex is 2, 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_OutOfRange if theIndex is not 1 or 2. Standard_ConstructionError if either of the following is less than or equal to gp::Resolution(): - Sqrt(theXv*theXv + theYv*theYv), or - the modulus of the number pair formed by the new value theXi and the other coordinate of this vector that was not directly modified. Raises OutOfRange if theIndex != {1, 2}.
 
void SetCoord (double theXv, double theYv)
 For this unit vector, assigns: - the values theXv and theYv to its two coordinates, Warning Remember that all the coordinates of a unit vector are implicitly modified when any single one is changed directly. Exceptions Standard_OutOfRange if theIndex is not 1 or 2. Standard_ConstructionError if either of the following is less than or equal to gp::Resolution(): - Sqrt(theXv*theXv + theYv*theYv), or - the modulus of the number pair formed by the new value Xi and the other coordinate of this vector that was not directly modified. Raises OutOfRange if theIndex != {1, 2}.
 
void SetX (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(): - the modulus of Coord, or - the modulus of the number pair formed from the new X or Y coordinate and the other coordinate of this vector that was not directly modified.
 
void SetY (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(): - the modulus of Coord, or - the modulus of the number pair formed from the new X or Y coordinate and the other coordinate of this vector that was not directly modified.
 
void SetXY (GXY theCoord)
 Assigns: - the two coordinates of theCoord to 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(): - the modulus of theCoord, or - the modulus of the number pair formed from the new X or Y coordinate and the other coordinate of this vector that was not directly modified.
 
double Coord (int theIndex)
 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}.
 
void Coord (ref double theXv, ref double theYv)
 For this unit vector returns its two coordinates theXv and theYv. Raises OutOfRange if theIndex != {1, 2}.
 
double X ()
 For this unit vector, returns its X coordinate.
 
double Y ()
 For this unit vector, returns its Y coordinate.
 
GXY XY ()
 For this unit vector, returns its two coordinates as a number pair. Comparison between Directions The precision value is an input data.
 
bool IsEqual (GDir2d theOther, double theAngularTolerance)
 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 (GDir2d theOther, double theAngularTolerance)
 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. Abs(Abs(<me>.Angle(theOther)) - PI/2.) <= theAngularTolerance
 
bool IsOpposite (GDir2d theOther, double theAngularTolerance)
 Returns True if the angle between this unit vector and the unit vector theOther is equal to Pi or -Pi (opposite). i.e. PI - Abs(<me>.Angle(theOther)) <= theAngularTolerance
 
bool IsParallel (GDir2d theOther, double theAngularTolerance)
 returns true if the angle between this unit vector and unit vector theOther is equal to 0, Pi or -Pi. i.e. Abs(Angle(<me>, theOther)) <= theAngularTolerance or PI - Abs(Angle(<me>, theOther)) <= theAngularTolerance
 
double Angle (GDir2d theOther)
 Computes the angular value in radians between <me> and <theOther>. Returns the angle in the range [-PI, PI].
 
double Crossed (GDir2d theRight)
 Computes the cross product between two directions.
 
double Dot (GDir2d theOther)
 Computes the scalar product
 
void Reverse ()
 
GDir2d Reversed ()
 Reverses the orientation of a direction
 
void Mirror (GDir2d theV)
 
GDir2d Mirrored (GDir2d theV)
 Performs the symmetrical transformation of a direction with respect to the direction theV which is the center of the symmetry.
 
void Mirror (GAx2d theA)
 
GDir2d Mirrored (GAx2d theA)
 Performs the symmetrical transformation of a direction with respect to an axis placement which is the axis of the symmetry.
 
void Rotate (double Ang)
 
GDir2d Rotated (double theAng)
 Rotates a direction. theAng is the angular value of the rotation in radians.
 
void Transform (GTrsf2d theT)
 
GDir2d Transformed (GTrsf2d theT)
 Transforms a direction with the "Trsf" theT. Warnings : If the scale factor of the "Trsf" theT is negative then the direction <me> is reversed.
 
override bool Equals (object obj)
 判断是否相等
 
override int GetHashCode ()
 返回对象的哈希值
 
override string ToString ()
 转换成字符串
 

属性

double x [get, set]
 
double y [get, set]
 

详细描述

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

2D方向

成员函数说明

◆ Equals()

override bool AnyCAD.Foundation.GDir2d.Equals ( object obj)

判断是否相等

参数
obj比较的对象
返回
true相等

◆ GetHashCode()

override int AnyCAD.Foundation.GDir2d.GetHashCode ( )

返回对象的哈希值

返回
哈希值

◆ ToString()

override string AnyCAD.Foundation.GDir2d.ToString ( )

转换成字符串

返回
字符串