b311480e |
1 | -- Created on: 1993-03-10 |
2 | -- Created by: JCV |
3 | -- Copyright (c) 1993-1999 Matra Datavision |
973c2be1 |
4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | -- |
973c2be1 |
6 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
7 | -- |
d5f74e42 |
8 | -- This library is free software; you can redistribute it and/or modify it under |
9 | -- the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
10 | -- by the Free Software Foundation, with special exception defined in the file |
11 | -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | -- distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
13 | -- |
973c2be1 |
14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
15 | -- commercial license or contractual agreement. |
7fd59977 |
16 | |
17 | class Direction from Geom inherits Vector from Geom |
18 | |
19 | ---Purpose : |
20 | -- The class Direction specifies a vector that is never null. |
21 | -- It is a unit vector. |
22 | |
23 | |
24 | uses Dir from gp, |
25 | Pnt from gp, |
26 | Trsf from gp, |
27 | Vec from gp, |
28 | Geometry from Geom |
29 | |
30 | raises ConstructionError from Standard |
31 | |
32 | is |
33 | |
34 | |
6e33d3ce |
35 | Create (X, Y, Z :Real) returns Direction |
7fd59977 |
36 | ---Purpose : Creates a unit vector with it 3 cartesian coordinates. |
37 | raises ConstructionError; |
38 | ---Purpose : |
39 | -- Raised if Sqrt( X*X + Y*Y + Z*Z) <= Resolution from gp. |
40 | |
6e33d3ce |
41 | Create (V : Dir) returns Direction; |
7fd59977 |
42 | ---Purpose : Creates a transient copy of <me>. |
43 | |
44 | |
45 | SetCoord (me : mutable; X, Y, Z : Real) |
46 | ---Purpose : Sets <me> to X,Y,Z coordinates. |
47 | raises ConstructionError; |
48 | ---Purpose : |
49 | -- Raised if Sqrt( X*X + Y*Y + Z*Z) <= Resolution from gp. |
50 | |
51 | |
52 | SetDir (me : mutable; V : Dir); |
53 | ---Purpose : Converts the gp_Dir unit vector V into this unit vector. |
54 | |
55 | |
56 | SetX (me : mutable; X : Real) |
57 | ---Purpose : Changes the X coordinate of <me>. |
58 | raises ConstructionError; |
59 | ---Purpose : |
60 | -- Raised if Sqrt( X*X + Y*Y + Z*Z) <= Resolution from gp. |
61 | |
62 | |
63 | SetY (me : mutable; Y : Real) |
64 | ---Purpose : Changes the Y coordinate of <me>. |
65 | raises ConstructionError; |
66 | ---Purpose : |
67 | -- Raised if Sqrt( X*X + Y*Y + Z*Z) <= Resolution from gp. |
68 | |
69 | |
70 | SetZ (me : mutable; Z : Real) |
71 | ---Purpose : Changes the Z coordinate of <me>. |
72 | raises ConstructionError; |
73 | ---Purpose : |
74 | -- Raised if Sqrt( X*X + Y*Y + Z*Z) <= Resolution from gp. |
75 | |
76 | |
77 | Dir (me) returns Dir; |
78 | ---Purpose : |
79 | -- Returns the non transient direction with the same |
80 | -- coordinates as <me>. |
81 | |
82 | |
83 | Magnitude (me) returns Real; |
84 | ---Purpose : returns 1.0 which is the magnitude of any unit vector. |
85 | |
86 | |
87 | SquareMagnitude (me) returns Real; |
88 | ---Purpose : returns 1.0 which is the square magnitude of any unit vector. |
89 | |
90 | Cross (me : mutable; Other : Vector) |
91 | ---Purpose : |
92 | -- Computes the cross product between <me> and <Other>. |
93 | raises ConstructionError; |
94 | ---Purpose : |
95 | -- Raised if the two vectors are parallel because it is |
96 | -- not possible to have a direction with null length. |
97 | |
98 | |
99 | CrossCross (me : mutable; V1, V2 : Vector) |
100 | ---Purpose : |
101 | -- Computes the triple vector product <me> ^(V1 ^ V2). |
102 | raises ConstructionError; |
103 | ---Purpose : |
104 | -- Raised if V1 and V2 are parallel or <me> and (V1 ^ V2) are |
105 | -- parallel |
106 | |
107 | |
6e33d3ce |
108 | Crossed (me; Other : Vector) returns like me |
7fd59977 |
109 | ---Purpose : |
110 | -- Computes the cross product between <me> and <Other>. |
111 | -- A new direction is returned. |
112 | |
113 | raises ConstructionError |
114 | ---Purpose : |
115 | -- Raised if the two vectors are parallel because it is |
116 | -- not possible to have a direction with null length. |
117 | is static; |
118 | |
119 | |
6e33d3ce |
120 | CrossCrossed (me; V1, V2 : Vector) returns like me |
7fd59977 |
121 | ---Purpose : |
122 | -- Computes the triple vector product <me> ^(V1 ^ V2). |
123 | raises ConstructionError |
124 | ---Purpose : |
125 | -- Raised if V1 and V2 are parallel or <me> and (V1 ^ V2) are |
126 | -- parallel |
127 | is static; |
128 | |
129 | |
130 | Transform (me : mutable; T : Trsf); |
131 | ---Purpose: Applies the transformation T to this unit vector, then normalizes it. |
132 | |
6e33d3ce |
133 | Copy (me) returns like me; |
7fd59977 |
134 | ---Purpose: Creates a new object which is a copy of this unit vector. |
135 | end; |
136 | |