Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mappevurderingprog2
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
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tam Minh Le
mappevurderingprog2
Merge requests
!25
Completed gameController
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Completed gameController
gameController
into
dev
Overview
0
Commits
1
Pipelines
0
Changes
8
Merged
Edvard Granheim Harbo
requested to merge
gameController
into
dev
1 year ago
Overview
0
Commits
1
Pipelines
0
Changes
8
Expand
0
0
Merge request reports
Compare
dev
dev (base)
and
latest version
latest version
a427a8fb
1 commit,
1 year ago
8 files
+
60
−
24
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
8
Search (e.g. *.vue) (Ctrl+P)
src/main/java/edu/ntnu/idatt2003/mappevurderingprog2/controllers/GameController.java
+
31
−
6
Options
package
edu.ntnu.idatt2003.mappevurderingprog2.controllers
;
import
edu.ntnu.idatt2003.mappevurderingprog2.models.Complex
;
import
edu.ntnu.idatt2003.mappevurderingprog2.models.JuliaTransform
;
import
edu.ntnu.idatt2003.mappevurderingprog2.models.Transform2D
;
import
edu.ntnu.idatt2003.mappevurderingprog2.models.Vector2D
;
import
edu.ntnu.idatt2003.mappevurderingprog2.models.chaos.ChaosGame
;
import
edu.ntnu.idatt2003.mappevurderingprog2.models.chaos.ChaosGameDescription
;
import
java
fx.event.ActionEven
t
;
import
java
fx.event.EventHandler
;
import
java
.util.ArrayLis
t
;
import
java
.util.List
;
public
class
GameController
{
public
void
setMinCoords
(
double
minX0
,
double
minX1
)
{
ChaosGame
.
getInstance
().
getDescription
().
setMinCoords
(
new
Vector2D
(
minX1
,
minX1
));
}
public
void
setMaxCoords
(
double
maxX0
,
double
maxX1
)
{
ChaosGame
.
getInstance
().
getDescription
().
setMaxCoords
(
new
Vector2D
(
maxX0
,
maxX1
));
}
public
void
setChaosGameDescription
(
ChaosGameDescription
description
)
{
ChaosGame
.
getInstance
().
setDescription
(
description
);
}
@@ -14,9 +25,23 @@ public class GameController {
ChaosGame
.
getInstance
().
setCanvas
(
width
,
height
);
}
public
void
runTransformation
(
ChaosGameDescription
description
,
int
width
,
int
height
,
int
steps
)
{
ChaosGame
.
getInstance
().
setDescription
(
description
);
ChaosGame
.
getInstance
().
setCanvas
(
width
,
height
);
ChaosGame
.
getInstance
().
runSteps
(
steps
);
public
void
setChaosGameSteps
(
int
steps
)
{
ChaosGame
.
getInstance
().
setSteps
(
steps
);
}
public
void
runTransformation
()
{
ChaosGame
.
getInstance
().
runSteps
();
}
public
void
setJuliaTransformation
(
Complex
point
)
{
List
<
Transform2D
>
transforms
=
new
ArrayList
<>();
// Add the JuliaTransform to the list of transforms
transforms
.
add
(
new
JuliaTransform
(
point
,
-
1
));
transforms
.
add
(
new
JuliaTransform
(
point
,
1
));
ChaosGame
.
getInstance
().
setDescription
(
new
ChaosGameDescription
(
transforms
,
new
Vector2D
(-
1.6
,
-
1.0
),
new
Vector2D
(
1.6
,
1.0
)));
}
public
void
setAffineTransformation
(
List
<
Transform2D
>
transforms
,
Vector2D
minCoords
,
Vector2D
maxCoords
)
{
ChaosGame
.
getInstance
().
setDescription
(
new
ChaosGameDescription
(
transforms
,
minCoords
,
maxCoords
));
}
}
Loading