1 -- Created on: 1993-03-24
3 -- Copyright (c) 1993-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
6 -- This file is part of Open CASCADE Technology software library.
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
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.
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
17 class VectorWithMagnitude from Geom2d inherits Vector from Geom2d
20 -- Defines a vector with magnitude.
21 -- A vector with magnitude can have a zero length.
28 raises ConstructionError from Standard
33 Create (V : Vec2d) returns VectorWithMagnitude;
34 --- Purpose : Creates a persistent copy of V.
37 Create (X, Y : Real) returns VectorWithMagnitude;
38 --- Purpose : Creates a vector with two cartesian coordinates.
41 Create (P1, P2 : Pnt2d) returns VectorWithMagnitude;
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
48 SetCoord (me : mutable; X, Y : Real);
49 --- Purpose : Set <me> to X, Y coordinates.
52 SetVec2d (me : mutable; V : Vec2d);
53 -- Purpose : Set <me> to V.X(), V.Y() coordinates.
56 SetX (me : mutable; X : Real);
57 --- Purpose : Changes the X coordinate of <me>.
60 SetY (me : mutable; Y : Real);
61 --- Purpose : Changes the Y coordinate of <me>
64 Magnitude (me) returns Real;
65 --- Purpose : Returns the magnitude of <me>.
68 SquareMagnitude (me) returns Real;
69 --- Purpose : Returns the square magnitude of <me>.
72 Add (me : mutable; Other : Vector);
74 -- Adds the Vector Other to <me>.
75 ---C++: alias operator +=
78 Added (me; Other : Vector) returns VectorWithMagnitude
80 -- Adds the vector Other to <me>.
81 ---C++: alias operator +
85 Crossed (me; Other : Vector) returns Real;
87 -- Computes the cross product between <me> and Other
88 -- <me> ^ Other. A new vector is returned.
89 ---C++: alias operator ^
92 Divide (me : mutable; Scalar : Real);
93 --- Purpose : Divides <me> by a scalar.
94 ---C++: alias operator /=
97 Divided (me; Scalar : Real) returns VectorWithMagnitude
99 -- Divides <me> by a scalar. A new vector is returned.
100 ---C++: alias operator /
104 Multiplied (me; Scalar : Real) returns VectorWithMagnitude
106 -- Computes the product of the vector <me> by a scalar.
107 -- A new vector is returned.
109 -- -C++: alias operator *
110 -- Collision with same operator defined for the class Vector!
114 Multiply (me : mutable; Scalar : Real);
116 -- Computes the product of the vector <me> by a scalar.
117 ---C++: alias operator *=
120 Normalize (me : mutable)
121 --- Purpose : Normalizes <me>.
122 raises ConstructionError;
124 -- Raised if the magnitude of the vector is lower or equal to
125 -- Resolution from package gp.
128 Normalized (me) returns VectorWithMagnitude
129 --- Purpose : Returns a copy of <me> Normalized.
130 raises ConstructionError
132 -- Raised if the magnitude of the vector is lower or equal to
133 -- Resolution from package gp.
137 Subtract (me : mutable; Other : Vector);
138 --- Purpose : Subtracts the Vector Other to <me>.
139 ---C++: alias operator -=
142 Subtracted (me; Other : Vector) returns VectorWithMagnitude
144 -- Subtracts the vector Other to <me>. A new vector is returned.
145 ---C++: alias operator -
150 Transform (me: mutable; T : Trsf2d);
151 ---Purpose: Applies the transformation T to this vector.
154 Copy (me) returns like me;
155 --- Purpose: Creates a new object which is a copy of this vector.