Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
asteroids
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hexboard-games
asteroids
Commits
a9f53b02
Commit
a9f53b02
authored
9 years ago
by
Memo Akten
Browse files
Options
Downloads
Patches
Plain Diff
fixes to Piers Vector2d
parent
c1c73b2d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/math/Vector2d.java
+9
-6
9 additions, 6 deletions
src/math/Vector2d.java
with
9 additions
and
6 deletions
src/math/Vector2d.java
+
9
−
6
View file @
a9f53b02
...
...
@@ -430,12 +430,15 @@ public class Vector2d {
return
((
x
*
v
.
getX
())
+
(
y
*
v
.
getY
()));
}
public
static
Vector2d
scalarProduct
(
Vector2d
v1
,
Vector2d
v2
)
{
public
static
double
scalarProduct
(
Vector2d
v1
,
Vector2d
v2
)
{
Vector2d
vector
=
new
Vector2d
(
v1
,
true
);
vector
.
scalarProduct
(
v2
);
return
vector
;
return
vector
.
scalarProduct
(
v2
);
}
public
double
dot
(
Vector2d
v
)
{
return
scalarProduct
(
v
);
}
public
static
double
dot
(
Vector2d
v1
,
Vector2d
v2
)
{
return
Vector2d
.
scalarProduct
(
v1
,
v2
);
}
public
static
Vector2d
toCartesian
(
Vector2d
input
)
{
double
x
=
(
input
.
getY
()
*
Math
.
cos
(
input
.
getR
()));
double
y
=
(
input
.
getY
()
*
Math
.
sin
(
input
.
getR
()));
...
...
@@ -490,10 +493,10 @@ public class Vector2d {
}
public
static
Vector2d
normalise
(
Vector2d
first
)
{
Vector2d
second
=
new
Vector2d
(
first
,
fals
e
);
Vector2d
second
=
new
Vector2d
(
first
,
tru
e
);
second
.
normalise
();
if
(
first
.
mutable
)
second
.
setToMutable
();
//
if (first.mutable)
//
second.setToMutable();
return
second
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment