Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F633091
Velocity.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
805 B
Referenced Files
None
Subscribers
None
Velocity.cpp
View Options
//
// Created by Ido Mozes on 02/07/2019.
//
#include
"Velocity.h"
Velocity
::
Velocity
(
float
x
,
float
y
)
:
value
{
x
,
y
}
{}
void
Velocity
::
turnDirection
(
float
deltaRad
)
{
auto
[
alpha
,
R
]
=
cartesianToPolar
(
value
.
X
,
value
.
Y
);
std
::
tie
(
value
.
X
,
value
.
Y
)
=
polarToCartesian
(
alpha
+
deltaRad
,
R
);
}
void
Velocity
::
setDirection
(
float
rad
)
{
auto
[
_
,
R
]
=
cartesianToPolar
(
value
.
X
,
value
.
Y
);
std
::
tie
(
value
.
X
,
value
.
Y
)
=
polarToCartesian
(
rad
,
R
);
}
void
Velocity
::
changeSpeed
(
float
deltaSpeed
)
{
auto
[
alpha
,
R
]
=
cartesianToPolar
(
value
.
X
,
value
.
Y
);
std
::
tie
(
value
.
X
,
value
.
Y
)
=
polarToCartesian
(
alpha
,
R
+
deltaSpeed
);
}
void
Velocity
::
setSpeed
(
float
speed
)
{
auto
[
alpha
,
_
]
=
cartesianToPolar
(
value
.
X
,
value
.
Y
);
std
::
tie
(
value
.
X
,
value
.
Y
)
=
polarToCartesian
(
alpha
,
speed
);
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Sun, Nov 15, 4:02 PM (1 d, 18 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
138804
Default Alt Text
Velocity.cpp (805 B)
Attached To
Mode
R74 BloonsTD
Attached
Detach File
Event Timeline