2 // File Graphic2d_Vertex.cxx
6 //-Copyright MatraDatavision 1993
10 //-Design Declaration des variables specifiques aux points
12 //-Warning Un point est defini par ses coordonnees
21 #include <Graphic2d_Vertex.ixx>
25 //-Global data definitions
26 static Standard_ShortReal epsilon = ShortRealEpsilon();
28 // -- les coordonnees du point
29 // myX : Standard_ShortReal;
30 // myY : Standard_ShortReal;
38 Graphic2d_Vertex::Graphic2d_Vertex () {
45 Graphic2d_Vertex::Graphic2d_Vertex (const Quantity_Length X, const Quantity_Length Y) {
47 myX = Standard_ShortReal (X);
48 myY = Standard_ShortReal (Y);
52 Graphic2d_Vertex::Graphic2d_Vertex (const Standard_ShortReal X, const Standard_ShortReal Y) {
59 void Graphic2d_Vertex::Coord (Quantity_Length& X, Quantity_Length& Y) const {
61 X = Quantity_Length (myX);
62 Y = Quantity_Length (myY);
66 Quantity_Length Graphic2d_Vertex::X () const {
68 return (Quantity_Length (myX));
72 Quantity_Length Graphic2d_Vertex::Y () const {
74 return (Quantity_Length (myY));
78 Standard_Boolean Graphic2d_Vertex::IsEqual(const Graphic2d_Vertex &other) const {
80 if( (Abs(myX - other.myX) > epsilon) ||
81 (Abs(myY - other.myY) > epsilon) ) return Standard_False;
82 else return Standard_True;
85 void Graphic2d_Vertex::SetCoord (const Quantity_Length Xnew, const Quantity_Length Ynew) {
87 myX = Standard_ShortReal (Xnew);
88 myY = Standard_ShortReal (Ynew);
92 void Graphic2d_Vertex::SetXCoord (const Quantity_Length Xnew) {
94 myX = Standard_ShortReal (Xnew);
98 void Graphic2d_Vertex::SetYCoord (const Quantity_Length Ynew) {
100 myY = Standard_ShortReal (Ynew);
104 Quantity_Length Graphic2d_Vertex::Distance (const Graphic2d_Vertex& AV1, const Graphic2d_Vertex& AV2) {
106 return (sqrt ( (AV1.X () - AV2.X ()) * (AV1.X () - AV2.X ())
107 + (AV1.Y () - AV2.Y ()) * (AV1.Y () - AV2.Y ())));