Add support for 3D simulations#38
Conversation
…tegration with scafi, changing Point2D to Point3D where needed
…lator-gui and continued work on integration with renderer-3d
…tings class to setup itself
…nued work on integration with renderer-3d
…s moving to the wrong position, also added Controller interface for easier integration with Scafi
…ectly shows the 3d points and connections.
…he correct colors are assigned when setting sensors.
…o that it's possible to right click. Also now the scene can be reset.
…when needed. Finally, the north menu shows correctly.
…r radius and to support observations
…dinate too. The 3d simulation should now also be faster but there is a problem with the javaFx UI thread getting flooded
…en rendering many nodes.
…ails. Also worket more to use ScatterMesh to optimize the rendering.
…ts and scala documentation
…e node size not changing
…o, moving nodes now have the correct color.
…the selection volume can be done in laptops.
…n unexpected way.
…xed a bug that sometimes prevented the camera from moving
…umption before executing the correct handler
…er also moved them
| var position: Point2D | ||
| var position: Point3D | ||
|
|
||
| def position2d: Point2D |
There was a problem hiding this comment.
Having both fields seem redundant. We should consider dropping position2d and just keeping position. 2D simulations shouldn't be affected, using Point3D objects with z=0, right?
There was a problem hiding this comment.
position2d is implemented simply as position with z=0. I created it so that the code that expects a Point2D still works without making any changes to it. Should i modify each use of Node's position so that they always expect a Point3D?
There was a problem hiding this comment.
We may drop position2d and when a 2D position is needed, just provide the 2D-view of the 3D position (maybe an implicit converter can safely help).
There was a problem hiding this comment.
I'll remove position2d. Would it be ok to put def toPoint2D: Point2D = new Point2D(p.x, p.y) inside it.unibo.scafi.space.optimization.RichPoint3D (or maybe even in Point3D itself)? That way everyone can reuse the 2d view logic.
There was a problem hiding this comment.
I see that
Point2Dis a subclass ofPoint3DPoint3Dalready has animplicit def toPoint2D(p: Point3D): Point2D = Point2D(p.x, p.y)
The latter can also be called explicitly, so there is no need of a new method.
| env: | ||
| global: | ||
| - RELEASE_SCALA_VERSION=2.12.2 | ||
| - RELEASE_SCALA_VERSION=2.12.10 |
There was a problem hiding this comment.
What was the reason for this increment of the version?
There was a problem hiding this comment.
This was done to avoid Scala-JDK compatibility problems when using JDK11.
I checked on docs.scala-lang.org and 2.12.4 seems the minimum 2.12 version required for JDK11, but it also says that
As of Scala 2.13.0, 2.12.8 and 2.11.12, JDK 11 support is incomplete
I finally saw that on the “Support JDK 11” issue they recently added
In general, Scala now works just fine on JDK 11
so i decided to upgrade to scala 2.12.10, to be safe.
Should i use a different version?
There was a problem hiding this comment.
No, I'd say it is fine! Thanks
|
|
||
| override def _3: Double = z | ||
|
|
||
| override def canEqual(otherObject: Any): Boolean = otherObject match {case _: Point3D => true; case _ => false} |
There was a problem hiding this comment.
Isn't this caught by scala style?
There was a problem hiding this comment.
Scalastyle is not catching it for me. I can rewrite canEqual as otherObject.isInstanceOf[Point3D], would that be ok?
There was a problem hiding this comment.
No, it is fine.
I was now thinking if we wanted Point3D(1,1,0)==Point2D(1,1) to be true or not: it might be reasonable but if this wasn't so before, that's fine.
|
Some TravisCI builds failed to download a bunch of dependencies, but my last commit simply modified some scala files. I think that at that moment Maven wasn't responding, so maybe we just have to retry the builds. Do i do that creating an empty commit? |
This pull request adds to Scafi the support for 3D simulations.