0023330: Redundant copying in Geom2d_OffsetCurve::Geom2d_OffsetCurve method
[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
4// Copyright (c) 1999-2012 OPEN CASCADE SAS
5//
6// The content of this file is subject to the Open CASCADE Technology Public
7// License Version 6.5 (the "License"). You may not use the content of this file
8// except in compliance with the License. Please obtain a copy of the License
9// at http://www.opencascade.org and read it completely before using this file.
10//
11// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13//
14// The Original Code and all software distributed under the License is
15// distributed on an "AS IS" basis, without warranty of any kind, and the
16// Initial Developer hereby disclaims all such warranties, including without
17// limitation, any warranties of merchantability, fitness for a particular
18// purpose or non-infringement. Please see the License for the specific terms
19// and conditions governing the rights and limitations under the License.
20
7fd59977 21
7fd59977 22
23#include <Geom2d_VectorWithMagnitude.ixx>
24
25
26typedef Geom2d_Vector Vector;
27typedef Geom2d_VectorWithMagnitude VectorWithMagnitude;
28typedef Handle(Geom2d_VectorWithMagnitude) Handle(VectorWithMagnitude);
29typedef Handle(Geom2d_Vector) Handle(Vector);
30
31typedef gp_Ax2d Ax2d;
32typedef gp_Pnt2d Pnt2d;
33typedef gp_Trsf2d Trsf2d;
34
35
36
37Geom2d_VectorWithMagnitude::Geom2d_VectorWithMagnitude (const gp_Vec2d& V)
38{ gpVec2d = V; }
39
40
41Geom2d_VectorWithMagnitude::Geom2d_VectorWithMagnitude (
42const Standard_Real X, const Standard_Real Y) { gpVec2d = gp_Vec2d (X, Y); }
43
44
45Geom2d_VectorWithMagnitude::Geom2d_VectorWithMagnitude (
46const Pnt2d& P1, const Pnt2d& P2) { gpVec2d = gp_Vec2d (P1, P2); }
47
48
49Handle(Geom2d_Geometry) Geom2d_VectorWithMagnitude::Copy() const {
50
51 Handle(VectorWithMagnitude) V;
52 V = new VectorWithMagnitude (gpVec2d);
53 return V;
54}
55
56
57void Geom2d_VectorWithMagnitude::SetCoord (const Standard_Real X, const Standard_Real Y) {
58
59 gpVec2d = gp_Vec2d (X, Y);
60}
61
62
63void Geom2d_VectorWithMagnitude::SetVec2d (const gp_Vec2d& V) { gpVec2d = V; }
64
65void Geom2d_VectorWithMagnitude::SetX (const Standard_Real X) { gpVec2d.SetX (X); }
66
67
68void Geom2d_VectorWithMagnitude::SetY (const Standard_Real Y) { gpVec2d.SetY (Y); }
69
70
71Standard_Real Geom2d_VectorWithMagnitude::Magnitude () const {
72
73 return gpVec2d.Magnitude ();
74}
75
76
77Standard_Real Geom2d_VectorWithMagnitude::SquareMagnitude () const {
78
79 return gpVec2d.SquareMagnitude ();
80}
81
82
83void Geom2d_VectorWithMagnitude::Add (const Handle(Vector)& Other) {
84
85 gpVec2d.Add (Other->Vec2d());
86}
87
88
89Handle(VectorWithMagnitude) Geom2d_VectorWithMagnitude::Added (
90
91const Handle(Vector)& Other) const {
92
93 gp_Vec2d Temp = Other->Vec2d();
94 Temp.Add (gpVec2d);
95 return new VectorWithMagnitude (Temp);
96}
97
98
99Standard_Real Geom2d_VectorWithMagnitude::Crossed (const Handle(Vector)& Other) const{
100
101 return gpVec2d.Crossed (Other->Vec2d());
102}
103
104
105void Geom2d_VectorWithMagnitude::Divide (const Standard_Real Scalar) {
106
107 gpVec2d.Divide (Scalar);
108}
109
110
111Handle(VectorWithMagnitude) Geom2d_VectorWithMagnitude::Divided (
112const Standard_Real Scalar) const {
113
114 gp_Vec2d V (gpVec2d);
115 V.Divide (Scalar);
116 return new VectorWithMagnitude (V);
117}
118
119
120Handle(VectorWithMagnitude) Geom2d_VectorWithMagnitude::Multiplied (
121const Standard_Real Scalar) const {
122
123 gp_Vec2d V(gpVec2d);
124 V.Multiply (Scalar);
125 return new VectorWithMagnitude (V);
126}
127
128
129void Geom2d_VectorWithMagnitude::Multiply (const Standard_Real Scalar) {
130
131 gpVec2d.Multiply (Scalar);
132}
133
134
135void Geom2d_VectorWithMagnitude::Normalize () { gpVec2d.Normalize (); }
136
137
138Handle(VectorWithMagnitude) Geom2d_VectorWithMagnitude::Normalized () const {
139
140 gp_Vec2d V = gpVec2d;
141 V.Normalized ();
142 return new VectorWithMagnitude (V);
143}
144
145
146void Geom2d_VectorWithMagnitude::Subtract (const Handle(Vector)& Other) {
147
148 gpVec2d.Subtract (Other->Vec2d());
149}
150
151
152Handle(VectorWithMagnitude) Geom2d_VectorWithMagnitude::Subtracted (
153const Handle(Vector)& Other) const {
154
155 gp_Vec2d V = gpVec2d;
156 V.Subtract (Other->Vec2d());
157 return new VectorWithMagnitude (V);
158}
159
160
161
162void Geom2d_VectorWithMagnitude::Transform (const Trsf2d& T) {
163
164 gpVec2d.Transform (T);
165}