summaryrefslogtreecommitdiff
path: root/src/Graphic3d/Graphic3d_Vertex.cxx
blob: 6cefd0487b5514b536eb711e3da17c545a2f5ff0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115

// File		Graphic3d_Vertex.cxx
// Created	Fevrier 1992
// Author	NW,JPB,CAL

//-Copyright	MatraDatavision 1991,1992

//-Version	

//-Design	Declaration des variables specifiques aux points

//-Warning	Un point est defini par ses coordonnees

//-References	

//-Language	C++ 2.0

//-Declarations

// for the class
#include <Graphic3d_Vertex.ixx>

//-Aliases

//-Global data definitions

//	-- les coordonnees du point
//	MyX		:	Standard_ShortReal;
//	MyY		:	Standard_ShortReal;
//	MyZ		:	Standard_ShortReal;

//-Constructors

//-Destructors

//-Methods, in order

Graphic3d_Vertex::Graphic3d_Vertex ():
MyX (Standard_ShortReal (0.0)),
MyY (Standard_ShortReal (0.0)),
MyZ (Standard_ShortReal (0.0)) {
}

Graphic3d_Vertex::Graphic3d_Vertex (const Graphic3d_Vertex& P) {

	MyX	= Standard_ShortReal (P.X ());
	MyY	= Standard_ShortReal (P.Y ());
	MyZ	= Standard_ShortReal (P.Z ());

}

Graphic3d_Vertex::Graphic3d_Vertex (const Standard_Real AX, const Standard_Real AY, const Standard_Real AZ):
MyX (Standard_ShortReal (AX)),
MyY (Standard_ShortReal (AY)),
MyZ (Standard_ShortReal (AZ)) {
}

void Graphic3d_Vertex::Coord (Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const {

	X	= Standard_Real (MyX);
	Y	= Standard_Real (MyY);
	Z	= Standard_Real (MyZ);

}

Standard_Real Graphic3d_Vertex::X () const {

	return Standard_Real (MyX);

}

Standard_Real Graphic3d_Vertex::Y () const {

	return Standard_Real (MyY);

}

Standard_Real Graphic3d_Vertex::Z () const {

	return Standard_Real (MyZ);

}

void Graphic3d_Vertex::SetCoord (const Standard_Real Xnew, const Standard_Real Ynew, const Standard_Real Znew) {

	MyX	= Standard_ShortReal (Xnew);
	MyY	= Standard_ShortReal (Ynew);
	MyZ	= Standard_ShortReal (Znew);

}

void Graphic3d_Vertex::SetXCoord (const Standard_Real Xnew) {

	MyX	= Standard_ShortReal (Xnew);

}

void Graphic3d_Vertex::SetYCoord (const Standard_Real Ynew) {

	MyY	= Standard_ShortReal (Ynew);

}

void Graphic3d_Vertex::SetZCoord (const Standard_Real Znew) {

	MyZ	= Standard_ShortReal (Znew);

}

Standard_Real Graphic3d_Vertex::Distance (const Graphic3d_Vertex& AV1, const Graphic3d_Vertex& AV2) {

	return (Sqrt ( (AV1.X () - AV2.X ()) * (AV1.X () - AV2.X ())
		     + (AV1.Y () - AV2.Y ()) * (AV1.Y () - AV2.Y ())
		     + (AV1.Z () - AV2.Z ()) * (AV1.Z () - AV2.Z ())));
}