7fd59977 |
1 | -- File: Geom2d_Direction.cdl |
2 | -- Created: Wed Mar 24 18:02:07 1993 |
3 | -- Author: JCV |
4 | -- <fid@sdsun2> |
5 | -- Copyright: Matra Datavision 1993 |
6 | |
7 | ---Copyright: Matra Datavision 1991 |
8 | |
9 | class Direction from Geom2d inherits Vector from Geom2d |
10 | |
11 | --- Purpose : |
12 | -- The class Direction specifies a vector that is never null. |
13 | -- It is a unit vector. |
14 | |
15 | |
16 | uses Dir2d from gp, |
17 | Pnt2d from gp, |
18 | Trsf2d from gp, |
19 | Vec2d from gp, |
20 | Geometry from Geom2d |
21 | |
22 | raises ConstructionError from Standard |
23 | |
24 | is |
25 | |
26 | |
27 | Create (X, Y :Real) returns mutable Direction |
28 | --- Purpose : Creates a unit vector with it 2 cartesian coordinates. |
29 | raises ConstructionError; |
30 | --- Purpose : |
31 | -- Raised if Sqrt( X*X + Y*Y) <= Resolution from gp. |
32 | |
33 | Create (V : Dir2d) returns mutable Direction; |
34 | --- Purpose : Creates a persistent copy of <me>. |
35 | |
36 | |
37 | |
38 | SetCoord (me : mutable; X, Y : Real) |
39 | --- Purpose : Assigns the coordinates X and Y to this unit vector, |
40 | -- then normalizes it. |
41 | -- Exceptions |
42 | -- Standard_ConstructionError if Sqrt(X*X + |
43 | -- Y*Y) is less than or equal to gp::Resolution(). |
44 | raises ConstructionError; |
45 | |
46 | |
47 | SetDir2d (me : mutable; V : Dir2d); |
48 | --- Purpose : Converts the gp_Dir2d unit vector V into this unit vector. |
49 | |
50 | |
51 | SetX (me : mutable; X : Real) |
52 | --- Purpose : |
53 | -- Assigns a value to the X coordinate of this unit vector, then normalizes it. |
54 | -- Exceptions |
55 | -- Standard_ConstructionError if the value assigned |
56 | -- causes the magnitude of the vector to become less |
57 | -- than or equal to gp::Resolution(). |
58 | raises ConstructionError; |
59 | |
60 | |
61 | SetY (me : mutable; Y : Real) |
62 | --- Purpose : Assigns a value to the Y coordinate of this unit vector, then normalizes it. |
63 | -- Exceptions |
64 | -- Standard_ConstructionError if the value assigned |
65 | -- causes the magnitude of the vector to become less |
66 | -- than or equal to gp::Resolution(). |
67 | raises ConstructionError; |
68 | |
69 | |
70 | Dir2d (me) returns Dir2d; |
71 | --- Purpose : Converts this unit vector into a gp_Dir2d unit vector. |
72 | |
73 | |
74 | Magnitude (me) returns Real; |
75 | --- Purpose : returns 1.0 |
76 | |
77 | |
78 | SquareMagnitude (me) returns Real; |
79 | --- Purpose : returns 1.0 |
80 | |
81 | |
82 | Crossed (me; Other : Vector) returns Real; |
83 | --- Purpose : Computes the cross product between <me> and <Other>. |
84 | ---C++: alias operator ^ |
85 | |
86 | |
87 | Transform (me : mutable; T : Trsf2d); |
88 | |
89 | ---Purpose: Applies the transformation T to this unit vector, then normalizes it. |
90 | |
91 | |
92 | Copy (me) returns mutable like me; |
93 | ---Purpose: Creates a new object which is a copy of this unit vector. |
94 | end; |
95 | |