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 VectorWithMagnitude from Geom2d inherits Vector from Geom2d |
18 | |
19 | --- Purpose : |
20 | -- Defines a vector with magnitude. |
21 | -- A vector with magnitude can have a zero length. |
22 | |
23 | uses Pnt2d from gp, |
24 | Trsf2d from gp, |
25 | Vec2d from gp, |
26 | Geometry from Geom2d |
27 | |
28 | raises ConstructionError from Standard |
29 | |
30 | is |
31 | |
32 | |
33 | Create (V : Vec2d) returns mutable VectorWithMagnitude; |
34 | --- Purpose : Creates a persistent copy of V. |
35 | |
36 | |
37 | Create (X, Y : Real) returns mutable VectorWithMagnitude; |
38 | --- Purpose : Creates a vector with two cartesian coordinates. |
39 | |
40 | |
41 | Create (P1, P2 : Pnt2d) returns mutable VectorWithMagnitude; |
42 | --- Purpose : |
43 | -- Creates a vector from the point P1 to the point P2. |
44 | -- The magnitude of the vector is the distance between P1 and P2 |
45 | |
46 | |
47 | |
48 | SetCoord (me : mutable; X, Y : Real); |
49 | --- Purpose : Set <me> to X, Y coordinates. |
50 | |
51 | |
52 | SetVec2d (me : mutable; V : Vec2d); |
53 | -- Purpose : Set <me> to V.X(), V.Y() coordinates. |
54 | |
55 | |
56 | SetX (me : mutable; X : Real); |
57 | --- Purpose : Changes the X coordinate of <me>. |
58 | |
59 | |
60 | SetY (me : mutable; Y : Real); |
61 | --- Purpose : Changes the Y coordinate of <me> |
62 | |
63 | |
64 | Magnitude (me) returns Real; |
65 | --- Purpose : Returns the magnitude of <me>. |
66 | |
67 | |
68 | SquareMagnitude (me) returns Real; |
69 | --- Purpose : Returns the square magnitude of <me>. |
70 | |
71 | |
72 | Add (me : mutable; Other : Vector); |
73 | --- Purpose : |
74 | -- Adds the Vector Other to <me>. |
75 | ---C++: alias operator += |
76 | |
77 | |
78 | Added (me; Other : Vector) returns mutable VectorWithMagnitude |
79 | --- Purpose : |
80 | -- Adds the vector Other to <me>. |
81 | ---C++: alias operator + |
82 | is static; |
83 | |
84 | |
85 | Crossed (me; Other : Vector) returns Real; |
86 | --- Purpose : |
87 | -- Computes the cross product between <me> and Other |
88 | -- <me> ^ Other. A new vector is returned. |
89 | ---C++: alias operator ^ |
90 | |
91 | |
92 | Divide (me : mutable; Scalar : Real); |
93 | --- Purpose : Divides <me> by a scalar. |
94 | ---C++: alias operator /= |
95 | |
96 | |
97 | Divided (me; Scalar : Real) returns mutable VectorWithMagnitude |
98 | --- Purpose : |
99 | -- Divides <me> by a scalar. A new vector is returned. |
100 | ---C++: alias operator / |
101 | is static; |
102 | |
103 | |
104 | Multiplied (me; Scalar : Real) returns mutable VectorWithMagnitude |
105 | --- Purpose : |
106 | -- Computes the product of the vector <me> by a scalar. |
107 | -- A new vector is returned. |
108 | -- |
109 | -- -C++: alias operator * |
110 | -- Collision with same operator defined for the class Vector! |
111 | is static; |
112 | |
113 | |
114 | Multiply (me : mutable; Scalar : Real); |
115 | --- Purpose : |
116 | -- Computes the product of the vector <me> by a scalar. |
117 | ---C++: alias operator *= |
118 | |
119 | |
120 | Normalize (me : mutable) |
121 | --- Purpose : Normalizes <me>. |
122 | raises ConstructionError; |
123 | --- Purpose : |
124 | -- Raised if the magnitude of the vector is lower or equal to |
125 | -- Resolution from package gp. |
126 | |
127 | |
128 | Normalized (me) returns mutable VectorWithMagnitude |
129 | --- Purpose : Returns a copy of <me> Normalized. |
130 | raises ConstructionError |
131 | --- Purpose : |
132 | -- Raised if the magnitude of the vector is lower or equal to |
133 | -- Resolution from package gp. |
134 | is static; |
135 | |
136 | |
137 | Subtract (me : mutable; Other : Vector); |
138 | --- Purpose : Subtracts the Vector Other to <me>. |
139 | ---C++: alias operator -= |
140 | |
141 | |
142 | Subtracted (me; Other : Vector) returns mutable VectorWithMagnitude |
143 | --- Purpose : |
144 | -- Subtracts the vector Other to <me>. A new vector is returned. |
145 | ---C++: alias operator - |
146 | is static; |
147 | |
148 | |
149 | |
150 | Transform (me: mutable; T : Trsf2d); |
151 | ---Purpose: Applies the transformation T to this vector. |
152 | |
153 | |
154 | Copy (me) returns mutable like me; |
155 | --- Purpose: Creates a new object which is a copy of this vector. |
156 | end; |
157 | |
158 | |