Skip to content

Commit

Permalink
[examples] Fixing the Sierpinski fractal demo.
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Galland <galland@arakhne.org>
  • Loading branch information
gallandarakhneorg committed Apr 11, 2019
1 parent c9c35d9 commit 6aa7827
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ abstract agent AbstractFractal {
* Generate triangle points
*/
def generatePoints {
triangle = new Triangle(
this.triangle = new Triangle(
screenSurface.bottomLeft,
screenSurface.bottomRight,
new Vector2D(screenSurface.bottomLeft.x + screenWidth / 2, screenSurface.topLeft.y)
Expand All @@ -65,15 +65,15 @@ abstract agent AbstractFractal {
* Multiply itself and create child Fractal
*/
def multiplication {
val screen1 = new Square(triangle.bottomLeft, screenWidth / 2)
val screen1 = new Square(this.triangle.bottomLeft, screenWidth / 2)
spawnInContext(typeof(ChildFractal), innerContext, screen1, positions)

val screen2 = new Square(
new Vector2D(screenSurface.bottomLeft.x + screenWidth / 4, screenSurface.bottomLeft.y + screenWidth / 2),
screenWidth / 2)
spawnInContext(typeof(ChildFractal), innerContext, screen2, positions)

val screen3 = new Square(new Vector2D(triangle.top.x, screenSurface.bottomLeft.y), screenWidth / 2)
val screen3 = new Square(new Vector2D(this.triangle.top.x, screenSurface.bottomLeft.y), screenWidth / 2)
spawnInContext(typeof(ChildFractal), innerContext, screen3, positions)
}
/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@

package io.sarl.demos.sierpinskiFractals.agents

import io.sarl.core.Behaviors
import io.sarl.core.DefaultContextInteractions
import io.sarl.core.Initialize
import io.sarl.demos.sierpinskiFractals.events.Refresh
import io.sarl.demos.sierpinskiFractals.objects.Positions
import io.sarl.demos.sierpinskiFractals.objects.Square
import io.sarl.javafx.FXKillSupportBehavior
import io.sarl.core.Behaviors

/**
* Child fractal agent.
Expand All @@ -38,7 +38,7 @@ import io.sarl.javafx.FXKillSupportBehavior
*/
agent ChildFractal extends AbstractFractal {

uses Behaviors, DefaultContextInteractions
uses DefaultContextInteractions, Behaviors

/*
* Initialization step for smaller fractals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import java.util.List
* @author Antoine Bartuccio
* @author Nicolas Gaud
*/
public class Positions {
class Positions {

val frac = new ArrayList<Triangle>

Expand All @@ -41,7 +41,7 @@ public class Positions {
}
}

public def getTriangles(): List<Triangle> {
def getTriangles(): List<Triangle> {
synchronized(frac) {
frac.unmodifiableView
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ package io.sarl.demos.sierpinskiFractals.objects
* @author Antoine Bartuccio
* @author Nicolas Gaud
*/
public class Square {
class Square {

var bottomLeft : Vector2D
var topLeft : Vector2D
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ package io.sarl.demos.sierpinskiFractals.objects
* @author Antoine Bartuccio
* @author Nicolas Gaud
*/
public class Vector2D {
class Vector2D {

var y: double
var x: double
Expand Down

0 comments on commit 6aa7827

Please sign in to comment.