0025124: [Feature request] Removal of continuity checks for offset geometries
[occt.git] / src / Geom2d / Geom2d_VectorWithMagnitude.cxx
CommitLineData
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#include <Geom2d_VectorWithMagnitude.ixx>
18
19
20typedef Geom2d_Vector Vector;
21typedef Geom2d_VectorWithMagnitude VectorWithMagnitude;
22typedef Handle(Geom2d_VectorWithMagnitude) Handle(VectorWithMagnitude);
23typedef Handle(Geom2d_Vector) Handle(Vector);
24
25typedef gp_Ax2d Ax2d;
26typedef gp_Pnt2d Pnt2d;
27typedef gp_Trsf2d Trsf2d;
28
29
30
31Geom2d_VectorWithMagnitude::Geom2d_VectorWithMagnitude (const gp_Vec2d& V)
32{ gpVec2d = V; }
33
34
35Geom2d_VectorWithMagnitude::Geom2d_VectorWithMagnitude (
36const Standard_Real X, const Standard_Real Y) { gpVec2d = gp_Vec2d (X, Y); }
37
38
39Geom2d_VectorWithMagnitude::Geom2d_VectorWithMagnitude (
40const Pnt2d& P1, const Pnt2d& P2) { gpVec2d = gp_Vec2d (P1, P2); }
41
42
43Handle(Geom2d_Geometry) Geom2d_VectorWithMagnitude::Copy() const {
44
45 Handle(VectorWithMagnitude) V;
46 V = new VectorWithMagnitude (gpVec2d);
47 return V;
48}
49
50
51void Geom2d_VectorWithMagnitude::SetCoord (const Standard_Real X, const Standard_Real Y) {
52
53 gpVec2d = gp_Vec2d (X, Y);
54}
55
56
57void Geom2d_VectorWithMagnitude::SetVec2d (const gp_Vec2d& V) { gpVec2d = V; }
58
59void Geom2d_VectorWithMagnitude::SetX (const Standard_Real X) { gpVec2d.SetX (X); }
60
61
62void Geom2d_VectorWithMagnitude::SetY (const Standard_Real Y) { gpVec2d.SetY (Y); }
63
64
65Standard_Real Geom2d_VectorWithMagnitude::Magnitude () const {
66
67 return gpVec2d.Magnitude ();
68}
69
70
71Standard_Real Geom2d_VectorWithMagnitude::SquareMagnitude () const {
72
73 return gpVec2d.SquareMagnitude ();
74}
75
76
77void Geom2d_VectorWithMagnitude::Add (const Handle(Vector)& Other) {
78
79 gpVec2d.Add (Other->Vec2d());
80}
81
82
83Handle(VectorWithMagnitude) Geom2d_VectorWithMagnitude::Added (
84
85const Handle(Vector)& Other) const {
86
87 gp_Vec2d Temp = Other->Vec2d();
88 Temp.Add (gpVec2d);
89 return new VectorWithMagnitude (Temp);
90}
91
92
93Standard_Real Geom2d_VectorWithMagnitude::Crossed (const Handle(Vector)& Other) const{
94
95 return gpVec2d.Crossed (Other->Vec2d());
96}
97
98
99void Geom2d_VectorWithMagnitude::Divide (const Standard_Real Scalar) {
100
101 gpVec2d.Divide (Scalar);
102}
103
104
105Handle(VectorWithMagnitude) Geom2d_VectorWithMagnitude::Divided (
106const Standard_Real Scalar) const {
107
108 gp_Vec2d V (gpVec2d);
109 V.Divide (Scalar);
110 return new VectorWithMagnitude (V);
111}
112
113
114Handle(VectorWithMagnitude) Geom2d_VectorWithMagnitude::Multiplied (
115const Standard_Real Scalar) const {
116
117 gp_Vec2d V(gpVec2d);
118 V.Multiply (Scalar);
119 return new VectorWithMagnitude (V);
120}
121
122
123void Geom2d_VectorWithMagnitude::Multiply (const Standard_Real Scalar) {
124
125 gpVec2d.Multiply (Scalar);
126}
127
128
129void Geom2d_VectorWithMagnitude::Normalize () { gpVec2d.Normalize (); }
130
131
132Handle(VectorWithMagnitude) Geom2d_VectorWithMagnitude::Normalized () const {
133
134 gp_Vec2d V = gpVec2d;
135 V.Normalized ();
136 return new VectorWithMagnitude (V);
137}
138
139
140void Geom2d_VectorWithMagnitude::Subtract (const Handle(Vector)& Other) {
141
142 gpVec2d.Subtract (Other->Vec2d());
143}
144
145
146Handle(VectorWithMagnitude) Geom2d_VectorWithMagnitude::Subtracted (
147const Handle(Vector)& Other) const {
148
149 gp_Vec2d V = gpVec2d;
150 V.Subtract (Other->Vec2d());
151 return new VectorWithMagnitude (V);
152}
153
154
155
156void Geom2d_VectorWithMagnitude::Transform (const Trsf2d& T) {
157
158 gpVec2d.Transform (T);
159}