summaryrefslogtreecommitdiff
path: root/src/Geom2d/Geom2d_VectorWithMagnitude.cxx
blob: 99e110450f80e84f68f0b72db43d535e3a2b763d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
// File:	Geom2d_VectorWithMagnitude.cxx
// Created:	Wed Mar 24 19:32:14 1993
// Author:	JCV
//		<fid@sdsun2>
// Copyright:	Matra Datavision 1993

//File Geom2d_VectorWithMagnitude.cxx, JCV 16/01/91

#include <Geom2d_VectorWithMagnitude.ixx>


typedef Geom2d_Vector Vector;
typedef Geom2d_VectorWithMagnitude         VectorWithMagnitude;
typedef Handle(Geom2d_VectorWithMagnitude) Handle(VectorWithMagnitude);
typedef Handle(Geom2d_Vector)              Handle(Vector);

typedef gp_Ax2d   Ax2d;
typedef gp_Pnt2d  Pnt2d;
typedef gp_Trsf2d Trsf2d;



Geom2d_VectorWithMagnitude::Geom2d_VectorWithMagnitude (const gp_Vec2d& V) 
{ gpVec2d = V; }


Geom2d_VectorWithMagnitude::Geom2d_VectorWithMagnitude (
const Standard_Real X,  const Standard_Real Y) { gpVec2d = gp_Vec2d (X, Y); }


Geom2d_VectorWithMagnitude::Geom2d_VectorWithMagnitude (
const Pnt2d& P1, const Pnt2d& P2) { gpVec2d = gp_Vec2d (P1, P2); }


Handle(Geom2d_Geometry) Geom2d_VectorWithMagnitude::Copy() const {

  Handle(VectorWithMagnitude) V;
  V = new VectorWithMagnitude (gpVec2d);
  return V; 
}


void Geom2d_VectorWithMagnitude::SetCoord (const Standard_Real X, const Standard_Real Y) {

  gpVec2d = gp_Vec2d (X, Y);
}


void Geom2d_VectorWithMagnitude::SetVec2d (const gp_Vec2d& V) { gpVec2d = V; }

void Geom2d_VectorWithMagnitude::SetX (const Standard_Real X) { gpVec2d.SetX (X); }


void Geom2d_VectorWithMagnitude::SetY (const Standard_Real Y) { gpVec2d.SetY (Y); }


Standard_Real Geom2d_VectorWithMagnitude::Magnitude () const { 
  
  return gpVec2d.Magnitude ();
}


Standard_Real Geom2d_VectorWithMagnitude::SquareMagnitude () const { 

  return gpVec2d.SquareMagnitude ();
}


void Geom2d_VectorWithMagnitude::Add (const Handle(Vector)& Other) { 

  gpVec2d.Add (Other->Vec2d());
}


Handle(VectorWithMagnitude) Geom2d_VectorWithMagnitude::Added (

const Handle(Vector)& Other) const { 
     
 gp_Vec2d Temp = Other->Vec2d();
 Temp.Add (gpVec2d);  
 return new VectorWithMagnitude (Temp);
}


Standard_Real Geom2d_VectorWithMagnitude::Crossed (const Handle(Vector)& Other) const{ 

  return gpVec2d.Crossed (Other->Vec2d());
}


void Geom2d_VectorWithMagnitude::Divide (const Standard_Real Scalar) { 

   gpVec2d.Divide (Scalar);
}


Handle(VectorWithMagnitude) Geom2d_VectorWithMagnitude::Divided (
const Standard_Real Scalar) const { 

  gp_Vec2d V (gpVec2d);
  V.Divide (Scalar);
  return new VectorWithMagnitude (V);
}


Handle(VectorWithMagnitude) Geom2d_VectorWithMagnitude::Multiplied (
const Standard_Real Scalar) const { 

  gp_Vec2d V(gpVec2d);
  V.Multiply (Scalar);
  return new VectorWithMagnitude (V);
}


void Geom2d_VectorWithMagnitude::Multiply (const Standard_Real Scalar) { 

   gpVec2d.Multiply (Scalar);
}


void Geom2d_VectorWithMagnitude::Normalize () { gpVec2d.Normalize (); }


Handle(VectorWithMagnitude) Geom2d_VectorWithMagnitude::Normalized () const { 

   gp_Vec2d V = gpVec2d;
   V.Normalized ();
   return new VectorWithMagnitude (V);
}


void Geom2d_VectorWithMagnitude::Subtract (const Handle(Vector)& Other) { 

  gpVec2d.Subtract (Other->Vec2d());
}


Handle(VectorWithMagnitude) Geom2d_VectorWithMagnitude::Subtracted (
const Handle(Vector)& Other) const { 

  gp_Vec2d V = gpVec2d;
  V.Subtract (Other->Vec2d());
  return new VectorWithMagnitude (V);
}



void Geom2d_VectorWithMagnitude::Transform (const Trsf2d& T) { 

  gpVec2d.Transform (T);
}