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
116
117
118
119
120
121
122
123
124
125
126
127
|
-- File: Geom_Direction.cdl
-- Created: Wed Mar 10 09:40:08 1993
-- Author: JCV
-- <fid@phylox>
-- Copyright: Matra Datavision 1993
class Direction from Geom inherits Vector from Geom
---Purpose :
-- The class Direction specifies a vector that is never null.
-- It is a unit vector.
uses Dir from gp,
Pnt from gp,
Trsf from gp,
Vec from gp,
Geometry from Geom
raises ConstructionError from Standard
is
Create (X, Y, Z :Real) returns mutable Direction
---Purpose : Creates a unit vector with it 3 cartesian coordinates.
raises ConstructionError;
---Purpose :
-- Raised if Sqrt( X*X + Y*Y + Z*Z) <= Resolution from gp.
Create (V : Dir) returns mutable Direction;
---Purpose : Creates a transient copy of <me>.
SetCoord (me : mutable; X, Y, Z : Real)
---Purpose : Sets <me> to X,Y,Z coordinates.
raises ConstructionError;
---Purpose :
-- Raised if Sqrt( X*X + Y*Y + Z*Z) <= Resolution from gp.
SetDir (me : mutable; V : Dir);
---Purpose : Converts the gp_Dir unit vector V into this unit vector.
SetX (me : mutable; X : Real)
---Purpose : Changes the X coordinate of <me>.
raises ConstructionError;
---Purpose :
-- Raised if Sqrt( X*X + Y*Y + Z*Z) <= Resolution from gp.
SetY (me : mutable; Y : Real)
---Purpose : Changes the Y coordinate of <me>.
raises ConstructionError;
---Purpose :
-- Raised if Sqrt( X*X + Y*Y + Z*Z) <= Resolution from gp.
SetZ (me : mutable; Z : Real)
---Purpose : Changes the Z coordinate of <me>.
raises ConstructionError;
---Purpose :
-- Raised if Sqrt( X*X + Y*Y + Z*Z) <= Resolution from gp.
Dir (me) returns Dir;
---Purpose :
-- Returns the non transient direction with the same
-- coordinates as <me>.
Magnitude (me) returns Real;
---Purpose : returns 1.0 which is the magnitude of any unit vector.
SquareMagnitude (me) returns Real;
---Purpose : returns 1.0 which is the square magnitude of any unit vector.
Cross (me : mutable; Other : Vector)
---Purpose :
-- Computes the cross product between <me> and <Other>.
raises ConstructionError;
---Purpose :
-- Raised if the two vectors are parallel because it is
-- not possible to have a direction with null length.
CrossCross (me : mutable; V1, V2 : Vector)
---Purpose :
-- Computes the triple vector product <me> ^(V1 ^ V2).
raises ConstructionError;
---Purpose :
-- Raised if V1 and V2 are parallel or <me> and (V1 ^ V2) are
-- parallel
Crossed (me; Other : Vector) returns mutable like me
---Purpose :
-- Computes the cross product between <me> and <Other>.
-- A new direction is returned.
raises ConstructionError
---Purpose :
-- Raised if the two vectors are parallel because it is
-- not possible to have a direction with null length.
is static;
CrossCrossed (me; V1, V2 : Vector) returns mutable like me
---Purpose :
-- Computes the triple vector product <me> ^(V1 ^ V2).
raises ConstructionError
---Purpose :
-- Raised if V1 and V2 are parallel or <me> and (V1 ^ V2) are
-- parallel
is static;
Transform (me : mutable; T : Trsf);
---Purpose: Applies the transformation T to this unit vector, then normalizes it.
Copy (me) returns mutable like me;
---Purpose: Creates a new object which is a copy of this unit vector.
end;
|