Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FlowSim
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
Container 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
iRMB
FlowSim
Commits
efe58626
Commit
efe58626
authored
3 years ago
by
Soeren Peters
Browse files
Options
Downloads
Patches
Plain Diff
Add spline painting to exercise.
parent
069125f5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+14
-1
14 additions, 1 deletion
README.md
src/main/java/irmb/flowsim/view/graphics/PaintableSpline.java
+26
-2
26 additions, 2 deletions
...main/java/irmb/flowsim/view/graphics/PaintableSpline.java
with
40 additions
and
3 deletions
README.md
+
14
−
1
View file @
efe58626
...
@@ -84,4 +84,17 @@ In this exercise we need to implement this new method in the following classes:
...
@@ -84,4 +84,17 @@ In this exercise we need to implement this new method in the following classes:
view/graphics/PaintableBezierCurve.java
view/graphics/PaintableBezierCurve.java
### Expected behavior:
### Expected behavior:
Bezier Curve can be painted as before.
Bezier Curve can be painted as before.
\ No newline at end of file
## Exercise 7
This exercise is based on the tenth lecture about the spline interpolation method.
In this exercise we need to implement this new interpolation method in the following classes:
model/Spline.java
Additionally, the following class was added to the project:
view/graphics/PaintableSpline.java
### Expected behavior:
Spline interpolation can be painted.
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/main/java/irmb/flowsim/view/graphics/PaintableSpline.java
+
26
−
2
View file @
efe58626
...
@@ -23,9 +23,33 @@ public class PaintableSpline extends PaintableShape {
...
@@ -23,9 +23,33 @@ public class PaintableSpline extends PaintableShape {
@Override
@Override
public
void
paint
(
Painter
painter
)
{
public
void
paint
(
Painter
painter
)
{
//TODO
List
<
Point
>
pointList
=
spline
.
getPointList
();
}
int
numOfPoints
=
100
;
painter
.
setColor
(
Color
.
BLACK
);
// Spline zeichnen
if
(
pointList
.
size
()
>
2
)
{
for
(
int
i
=
0
;
i
<
numOfPoints
-
1
;
i
++)
{
double
t1
=
(
i
)
/
(
double
)
(
numOfPoints
-
1
);
double
t2
=
(
i
+
1.0
)
/
(
double
)
(
numOfPoints
-
1
);
Point
p1
=
spline
.
getPointOnSpline
(
t1
);
Point
p2
=
spline
.
getPointOnSpline
(
t2
);
// draw line
painter
.
paintLine
(
p1
,
p2
);
}
}
// Kontrollpunkte zeichnen
for
(
int
i
=
0
;
i
<
pointList
.
size
();
i
++)
{
Point
p
=
pointList
.
get
(
i
);
int
k
=
4
;
Point
p_view
=
trafo
.
transformToPointOnScreen
(
p
);
painter
.
paintLine
(
p_view
.
getX
()
-
k
,
p_view
.
getY
()
-
k
,
p_view
.
getX
()
+
k
,
p_view
.
getY
()
+
k
);
painter
.
paintLine
(
p_view
.
getX
()
+
k
,
p_view
.
getY
()
-
k
,
p_view
.
getX
()
-
k
,
p_view
.
getY
()
+
k
);
}
}
...
...
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