7fd59977 |
1 | -- File: Geom_VectorWithMagnitude.cdl |
2 | -- Created: Wed Mar 10 11:03:19 1993 |
3 | -- Author: JCV |
4 | -- <fid@phylox> |
5 | -- Copyright: Matra Datavision 1993 |
6 | |
7 | |
8 | class VectorWithMagnitude from Geom inherits Vector from Geom |
9 | |
10 | ---Purpose : |
11 | -- Defines a vector with magnitude. |
12 | -- A vector with magnitude can have a zero length. |
13 | |
14 | uses Pnt from gp, |
15 | Trsf from gp, |
16 | Vec from gp, |
17 | Geometry from Geom |
18 | |
19 | raises ConstructionError from Standard |
20 | |
21 | is |
22 | |
23 | Create (V : Vec) returns mutable VectorWithMagnitude; |
24 | ---Purpose : Creates a transient copy of V. |
25 | |
26 | |
27 | Create (X, Y, Z : Real) returns mutable VectorWithMagnitude; |
28 | ---Purpose : Creates a vector with three cartesian coordinates. |
29 | |
30 | |
31 | Create (P1, P2 : Pnt) returns mutable VectorWithMagnitude; |
32 | ---Purpose : |
33 | -- Creates a vector from the point P1 to the point P2. |
34 | -- The magnitude of the vector is the distance between P1 and P2 |
35 | |
36 | |
37 | |
38 | |
39 | SetCoord (me : mutable; X, Y, Z : Real); |
40 | ---Purpose : Assigns the values X, Y and Z to the coordinates of this vector. |
41 | |
42 | |
43 | SetVec (me : mutable; V : Vec); |
44 | --- Purpose : Converts the gp_Vec vector V into this vector. |
45 | |
46 | SetX (me : mutable; X : Real); |
47 | ---Purpose : Changes the X coordinate of <me>. |
48 | |
49 | |
50 | SetY (me : mutable; Y : Real); |
51 | ---Purpose : Changes the Y coordinate of <me> |
52 | |
53 | |
54 | SetZ (me : mutable; Z : Real); |
55 | ---Purpose : Changes the Z coordinate of <me>. |
56 | |
57 | |
58 | Magnitude (me) returns Real; |
59 | ---Purpose : Returns the magnitude of <me>. |
60 | |
61 | |
62 | SquareMagnitude (me) returns Real; |
63 | ---Purpose : Returns the square magnitude of <me>. |
64 | |
65 | |
66 | Add (me : mutable; Other : Vector); |
67 | ---Purpose : |
68 | -- Adds the Vector Other to <me>. |
69 | |
70 | |
71 | Added (me; Other : Vector) returns mutable VectorWithMagnitude |
72 | ---Purpose : |
73 | -- Adds the vector Other to <me>. |
74 | |
75 | is static; |
76 | |
77 | |
78 | Cross (me : mutable; Other : Vector); |
79 | ---Purpose : |
80 | -- Computes the cross product between <me> and Other |
81 | -- <me> ^ Other. |
82 | |
83 | |
84 | Crossed (me; Other : Vector) returns mutable like me |
85 | ---Purpose : |
86 | -- Computes the cross product between <me> and Other |
87 | -- <me> ^ Other. A new vector is returned. |
88 | is static; |
89 | |
90 | |
91 | CrossCross (me : mutable; V1, V2 : Vector); |
92 | ---Purpose : |
93 | -- Computes the triple vector product <me> ^ (V1 ^ V2). |
94 | |
95 | |
96 | CrossCrossed (me; V1, V2 : Vector) returns mutable like me |
97 | ---Purpose : |
98 | -- Computes the triple vector product <me> ^ (V1 ^ V2). |
99 | -- A new vector is returned. |
100 | is static; |
101 | |
102 | |
103 | Divide (me : mutable; Scalar : Real); |
104 | ---Purpose : Divides <me> by a scalar. |
105 | |
106 | |
107 | Divided (me; Scalar : Real) returns mutable VectorWithMagnitude |
108 | ---Purpose : |
109 | -- Divides <me> by a scalar. A new vector is returned. |
110 | is static; |
111 | |
112 | |
113 | Multiplied (me; Scalar : Real) returns mutable VectorWithMagnitude |
114 | ---Purpose : |
115 | -- Computes the product of the vector <me> by a scalar. |
116 | -- A new vector is returned. |
117 | |
118 | is static; |
119 | |
120 | |
121 | Multiply (me : mutable; Scalar : Real); |
122 | ---Purpose : |
123 | -- Computes the product of the vector <me> by a scalar. |
124 | |
125 | Normalize (me : mutable) |
126 | ---Purpose : Normalizes <me>. |
127 | raises ConstructionError; |
128 | ---Purpose : |
129 | -- Raised if the magnitude of the vector is lower or equal to |
130 | -- Resolution from package gp. |
131 | |
132 | |
133 | Normalized (me) returns mutable VectorWithMagnitude |
134 | ---Purpose : Returns a copy of <me> Normalized. |
135 | raises ConstructionError |
136 | ---Purpose : |
137 | -- Raised if the magnitude of the vector is lower or equal to |
138 | -- Resolution from package gp. |
139 | is static; |
140 | |
141 | |
142 | Subtract (me : mutable; Other : Vector); |
143 | ---Purpose : Subtracts the Vector Other to <me>. |
144 | |
145 | |
146 | Subtracted (me; Other : Vector) returns mutable VectorWithMagnitude |
147 | ---Purpose : |
148 | -- Subtracts the vector Other to <me>. A new vector is returned. |
149 | |
150 | is static; |
151 | |
152 | |
153 | |
154 | Transform (me: mutable; T : Trsf); |
155 | |
156 | ---Purpose: Applies the transformation T to this vector. |
157 | |
158 | |
159 | Copy (me) returns mutable like me; |
160 | ---Purpose: Creates a new object which is a copy of this vector. |
161 | |
162 | end; |