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