- Indicator works correctly, sits in the right place, rotates around the boat correctly and sits on top of the water now.

tags : #story[1276]
This commit is contained in:
Alistair McIntyre
2017-09-27 19:20:33 +13:00
parent 0e9b818071
commit 0d212a4a1d
3 changed files with 56 additions and 157 deletions
@@ -4,13 +4,13 @@ import java.util.ArrayList;
import java.util.List;
import javafx.application.Platform;
import javafx.beans.property.ReadOnlyDoubleWrapper;
import javafx.collections.ObservableList;
import javafx.geometry.Point2D;
import javafx.geometry.Point3D;
import javafx.scene.Group;
import javafx.scene.paint.Color;
import javafx.scene.transform.Rotate;
import javafx.scene.transform.Transform;
import javafx.scene.transform.Scale;
import javafx.scene.transform.Translate;
/**
* BoatGroup is a javafx group that by default contains a graphical objects for representing a 2
@@ -87,15 +87,12 @@ public class BoatObject extends Group {
// calculate heading between boat and next mark
System.out.println(markPoint);
;
Point2D boatLoc = new Point2D(this.getLayoutX(), this.getLayoutY());
System.out.println(boatLoc);
Double angle = Math.toDegrees(
Math.atan2(boatLoc.getY() - markPoint.getY(), boatLoc.getX() - markPoint.getX())) - 90;
ObservableList<Transform> transforms = markIndicator.getTransforms();
Double radius = 3.0;
Double scale = 0.4;
@@ -104,13 +101,13 @@ public class BoatObject extends Group {
Double transX = (radius * Math.cos(Math.toRadians(angle)));
Double transY = (radius * Math.sin(Math.toRadians(angle)));
transforms.clear();
transforms.addAll(
new Rotate(angle, new Point3D(0, 0, 1))
// new Rotate(angle, 0,0, 0)
//new Translate(transX, transY, -1),
//new Scale(scale, scale, scale)
System.out.println(transX);
System.out.println(transY);
markIndicator.getTransforms().clear();
markIndicator.getTransforms().addAll(
new Rotate(angle, new Point3D(0, 0, 1)),
new Translate(0, -3, -0.1),
new Scale(scale, scale, scale / 3)
);
}
@@ -187,14 +187,7 @@ public class ModelFactory {
}
private static Model makeNextMarkIndicator(Group assets) {
// assets.getTransforms().addAll(
// new Translate(10, 10, 0),
// new Rotate(90, new Point3D(0,0,1)),
// new Scale(0.5, 0.5, 0.5)
// );
assets.getChildren().add(new AmbientLight());
return new Model(new Group(assets), null);
}
+47 -138
View File
@@ -5,135 +5,50 @@
<author>Blender User</author>
<authoring_tool>Blender 2.78.0 commit date:2016-09-26, commit time:12:42, hash:4bb1e22</authoring_tool>
</contributor>
<created>2017-09-27T15:59:29</created>
<modified>2017-09-27T15:59:29</modified>
<created>2017-09-27T19:18:31</created>
<modified>2017-09-27T19:18:31</modified>
<unit name="meter" meter="1"/>
<up_axis>Z_UP</up_axis>
</asset>
<library_cameras>
<camera id="Camera-camera" name="Camera">
<optics>
<technique_common>
<perspective>
<xfov sid="xfov">49.13434</xfov>
<aspect_ratio>1.777778</aspect_ratio>
<znear sid="znear">0.1</znear>
<zfar sid="zfar">100</zfar>
</perspective>
</technique_common>
</optics>
<extra>
<technique profile="blender">
<YF_dofdist>0</YF_dofdist>
<shiftx>0</shiftx>
<shifty>0</shifty>
</technique>
</extra>
</camera>
</library_cameras>
<library_lights>
<light id="Lamp-light" name="Lamp">
<technique_common>
<point>
<color sid="color">1 1 1</color>
<constant_attenuation>1</constant_attenuation>
<linear_attenuation>0</linear_attenuation>
<quadratic_attenuation>0.00111109</quadratic_attenuation>
</point>
</technique_common>
<extra>
<technique profile="blender">
<adapt_thresh>0.000999987</adapt_thresh>
<area_shape>1</area_shape>
<area_size>0.1</area_size>
<area_sizey>0.1</area_sizey>
<area_sizez>1</area_sizez>
<atm_distance_factor>1</atm_distance_factor>
<atm_extinction_factor>1</atm_extinction_factor>
<atm_turbidity>2</atm_turbidity>
<att1>0</att1>
<att2>1</att2>
<backscattered_light>1</backscattered_light>
<bias>1</bias>
<blue>1</blue>
<buffers>1</buffers>
<bufflag>0</bufflag>
<bufsize>2880</bufsize>
<buftype>2</buftype>
<clipend>30.002</clipend>
<clipsta>1.000799</clipsta>
<compressthresh>0.04999995</compressthresh>
<dist sid="blender_dist">29.99998</dist>
<energy sid="blender_energy">1</energy>
<falloff_type>2</falloff_type>
<filtertype>0</filtertype>
<flag>0</flag>
<gamma sid="blender_gamma">1</gamma>
<green>1</green>
<halo_intensity sid="blnder_halo_intensity">1</halo_intensity>
<horizon_brightness>1</horizon_brightness>
<mode>8192</mode>
<ray_samp>1</ray_samp>
<ray_samp_method>1</ray_samp_method>
<ray_samp_type>0</ray_samp_type>
<ray_sampy>1</ray_sampy>
<ray_sampz>1</ray_sampz>
<red>1</red>
<samp>3</samp>
<shadhalostep>0</shadhalostep>
<shadow_b sid="blender_shadow_b">0</shadow_b>
<shadow_g sid="blender_shadow_g">0</shadow_g>
<shadow_r sid="blender_shadow_r">0</shadow_r>
<sky_colorspace>0</sky_colorspace>
<sky_exposure>1</sky_exposure>
<skyblendfac>1</skyblendfac>
<skyblendtype>1</skyblendtype>
<soft>3</soft>
<spotblend>0.15</spotblend>
<spotsize>75</spotsize>
<spread>1</spread>
<sun_brightness>1</sun_brightness>
<sun_effect_type>0</sun_effect_type>
<sun_intensity>1</sun_intensity>
<sun_size>1</sun_size>
<type>0</type>
</technique>
</extra>
</light>
</library_lights>
<library_images/>
<library_effects>
<effect id="Material_001-effect">
<profile_COMMON>
<technique sid="common">
<phong>
<emission>
<color sid="emission">0 0 0 1</color>
</emission>
<ambient>
<color sid="ambient">0 0 0 1</color>
</ambient>
<diffuse>
<color sid="diffuse">0 0.3215737 0.002428917 1</color>
</diffuse>
<specular>
<color sid="specular">0.3229167 0.3229167 0.3229167 1</color>
</specular>
<shininess>
<float sid="shininess">50</float>
</shininess>
<index_of_refraction>
<float sid="index_of_refraction">1</float>
</index_of_refraction>
</phong>
</technique>
</profile_COMMON>
</effect>
</library_effects>
<library_materials>
<material id="Material_001-material" name="Material_001">
<instance_effect url="#Material_001-effect"/>
</material>
</library_materials>
<library_geometries>
<geometry id="Cube_001-mesh" name="Cube.001">
<mesh>
<source id="Cube_001-mesh-positions">
<float_array id="Cube_001-mesh-positions-array" count="0"/>
<technique_common>
<accessor source="#Cube_001-mesh-positions-array" count="0" stride="3">
<param name="X" type="float"/>
<param name="Y" type="float"/>
<param name="Z" type="float"/>
</accessor>
</technique_common>
</source>
<source id="Cube_001-mesh-normals">
<float_array id="Cube_001-mesh-normals-array" count="0"/>
<technique_common>
<accessor source="#Cube_001-mesh-normals-array" count="0" stride="3">
<param name="X" type="float"/>
<param name="Y" type="float"/>
<param name="Z" type="float"/>
</accessor>
</technique_common>
</source>
<vertices id="Cube_001-mesh-vertices">
<input semantic="POSITION" source="#Cube_001-mesh-positions"/>
</vertices>
</mesh>
</geometry>
<geometry id="Cone-mesh" name="Cone">
<mesh>
<source id="Cone-mesh-positions">
<float_array id="Cone-mesh-positions-array" count="99">0 1 -1 0 0 1 0.1950903 0.9807853 -1 0.3826835 0.9238795 -1 0.5555703 0.8314696 -1 0.7071068 0.7071068 -1 0.8314697 0.5555702 -1 0.9238795 0.3826834 -1 0.9807853 0.1950903 -1 1 0 -1 0.9807853 -0.1950902 -1 0.9238796 -0.3826833 -1 0.8314697 -0.5555702 -1 0.7071068 -0.7071068 -1 0.5555702 -0.8314697 -1 0.3826833 -0.9238796 -1 0.1950901 -0.9807853 -1 -3.25841e-7 -1 -1 -0.1950907 -0.9807852 -1 -0.3826839 -0.9238793 -1 -0.5555707 -0.8314693 -1 -0.7071073 -0.7071064 -1 -0.83147 -0.5555697 -1 -0.9238799 -0.3826827 -1 -0.9807854 -0.1950894 -1 -1 9.65599e-7 -1 -0.9807851 0.1950913 -1 -0.9238791 0.3826845 -1 -0.8314689 0.5555713 -1 -0.7071059 0.7071077 -1 -0.5555691 0.8314704 -1 -0.3826821 0.9238801 -1 -0.1950888 0.9807856 -1</float_array>
<float_array id="Cone-mesh-positions-array" count="99">0 1 -1 0 0 1 0.1950902 0.9807853 -1 0.3826835 0.9238795 -1 0.5555703 0.8314696 -1 0.7071068 0.7071068 -1 0.8314697 0.5555702 -1 0.9238795 0.3826834 -1 0.9807853 0.1950902 -1 1 0 -1 0.9807853 -0.1950902 -1 0.9238796 -0.3826833 -1 0.8314697 -0.5555702 -1 0.7071068 -0.7071068 -1 0.5555702 -0.8314697 -1 0.3826833 -0.9238796 -1 0.1950901 -0.9807853 -1 -3.25841e-7 -1 -1 -0.1950907 -0.9807852 -1 -0.3826839 -0.9238793 -1 -0.5555707 -0.8314693 -1 -0.7071073 -0.7071064 -1 -0.83147 -0.5555697 -1 -0.9238799 -0.3826827 -1 -0.9807854 -0.1950893 -1 -1 9.65599e-7 -1 -0.9807851 0.1950913 -1 -0.9238791 0.3826845 -1 -0.8314689 0.5555713 -1 -0.7071059 0.7071077 -1 -0.5555691 0.8314704 -1 -0.3826821 0.9238801 -1 -0.1950888 0.9807856 -1</float_array>
<technique_common>
<accessor source="#Cone-mesh-positions-array" count="33" stride="3">
<param name="X" type="float"/>
@@ -143,9 +58,9 @@
</technique_common>
</source>
<source id="Cone-mesh-normals">
<float_array id="Cone-mesh-normals-array" count="111">0.08775365 0.8909768 0.4454883 0.2598883 0.856737 0.4454884 0.4220357 0.7895733 0.4454885 0.5679646 0.6920667 0.4454883 0.6920668 0.5679646 0.4454883 0.7895735 0.4220356 0.4454884 0.856737 0.2598884 0.4454883 0.8909767 0.08775365 0.4454883 0.8909767 -0.08775341 0.4454883 0.856737 -0.2598884 0.4454884 0.7895734 -0.4220355 0.4454883 0.6920668 -0.5679646 0.4454883 0.5679646 -0.6920668 0.4454883 0.4220357 -0.7895733 0.4454883 0.2598879 -0.8567371 0.4454883 0.08775335 -0.8909768 0.4454884 -0.08775389 -0.8909767 0.4454883 -0.2598888 -0.8567368 0.4454884 -0.422036 -0.7895731 0.4454883 -0.5679649 -0.6920665 0.4454885 -0.6920673 -0.567964 0.4454882 -0.7895737 -0.4220352 0.4454885 -0.8567373 -0.2598874 0.4454883 -0.8909768 -0.08775281 0.4454883 -0.8909767 0.08775442 0.4454883 -0.8567367 0.2598893 0.4454884 -0.7895729 0.4220365 0.4454883 -0.6920661 0.5679656 0.4454883 -0.5679637 0.6920675 0.4454883 -0.4220346 0.7895739 0.4454883 -0.2598869 0.8567374 0.4454883 -0.08775299 0.8909768 0.4454884 0 0 -1 -3.97511e-6 0 -1 3.97512e-6 0 -1 3.88857e-7 0 -1 0 0 -1</float_array>
<float_array id="Cone-mesh-normals-array" count="99">0 0.8641175 -0.5032903 0 0 1 0.1685574 0.8475175 -0.5032917 0.3306731 0.7983459 -0.5032885 0.4800706 0.7184883 -0.5032959 0.6110231 0.6110231 -0.5032907 0.7184883 0.4800706 -0.5032959 0.7983459 0.3306731 -0.5032885 0.8475175 0.1685574 -0.5032917 0.8641175 0 -0.5032903 0.8475175 -0.1685574 -0.5032917 0.7983459 -0.3306731 -0.5032885 0.7184883 -0.4800706 -0.5032959 0.6110231 -0.6110231 -0.5032907 0.4800706 -0.7184883 -0.5032959 0.3306731 -0.7983459 -0.5032885 0.1685574 -0.8475175 -0.5032917 0 -0.8641175 -0.5032903 -0.1685574 -0.8475175 -0.5032917 -0.3306731 -0.7983459 -0.5032885 -0.4800706 -0.7184883 -0.5032959 -0.6110231 -0.6110231 -0.5032907 -0.7184883 -0.4800706 -0.5032959 -0.7983459 -0.3306731 -0.5032885 -0.8475175 -0.1685574 -0.5032917 -0.8641175 0 -0.5032903 -0.8475175 0.1685574 -0.5032917 -0.7983459 0.3306731 -0.5032885 -0.7184883 0.4800706 -0.5032959 -0.6110231 0.6110231 -0.5032907 -0.4800706 0.7184883 -0.5032959 -0.3306731 0.7983459 -0.5032885 -0.1685574 0.8475175 -0.5032917</float_array>
<technique_common>
<accessor source="#Cone-mesh-normals-array" count="37" stride="3">
<accessor source="#Cone-mesh-normals-array" count="33" stride="3">
<param name="X" type="float"/>
<param name="Y" type="float"/>
<param name="Z" type="float"/>
@@ -155,11 +70,11 @@
<vertices id="Cone-mesh-vertices">
<input semantic="POSITION" source="#Cone-mesh-positions"/>
</vertices>
<polylist count="62">
<polylist material="Material_001-material" count="62">
<input semantic="VERTEX" source="#Cone-mesh-vertices" offset="0"/>
<input semantic="NORMAL" source="#Cone-mesh-normals" offset="1"/>
<vcount>3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 </vcount>
<p>0 0 1 0 2 0 2 1 1 1 3 1 3 2 1 2 4 2 4 3 1 3 5 3 5 4 1 4 6 4 6 5 1 5 7 5 7 6 1 6 8 6 8 7 1 7 9 7 9 8 1 8 10 8 10 9 1 9 11 9 11 10 1 10 12 10 12 11 1 11 13 11 13 12 1 12 14 12 14 13 1 13 15 13 15 14 1 14 16 14 16 15 1 15 17 15 17 16 1 16 18 16 18 17 1 17 19 17 19 18 1 18 20 18 20 19 1 19 21 19 21 20 1 20 22 20 22 21 1 21 23 21 23 22 1 22 24 22 24 23 1 23 25 23 25 24 1 24 26 24 26 25 1 25 27 25 27 26 1 26 28 26 28 27 1 27 29 27 29 28 1 28 30 28 30 29 1 29 31 29 31 30 1 30 32 30 32 31 1 31 0 31 16 32 24 32 8 32 32 32 0 32 2 32 2 32 3 32 4 32 4 32 5 32 6 32 6 32 7 32 4 32 8 32 9 32 10 32 10 32 11 32 8 32 12 32 13 32 16 32 14 32 15 32 16 32 16 32 17 32 18 32 18 32 19 32 20 32 20 32 21 32 22 32 22 32 23 32 24 32 24 33 25 33 26 33 26 34 27 34 28 34 28 32 29 32 32 32 30 32 31 32 32 32 32 32 2 32 8 32 4 32 7 32 8 32 8 32 11 32 12 32 13 32 14 32 16 32 16 32 18 32 24 32 20 32 22 32 24 32 24 35 26 35 32 35 29 32 30 32 32 32 2 32 4 32 8 32 8 32 12 32 16 32 18 32 20 32 24 32 26 32 28 32 32 32 32 36 8 36 24 36</p>
<p>0 0 1 1 2 2 2 2 1 1 3 3 3 3 1 1 4 4 4 4 1 1 5 5 5 5 1 1 6 6 6 6 1 1 7 7 7 7 1 1 8 8 8 8 1 1 9 9 9 9 1 1 10 10 10 10 1 1 11 11 11 11 1 1 12 12 12 12 1 1 13 13 13 13 1 1 14 14 14 14 1 1 15 15 15 15 1 1 16 16 16 16 1 1 17 17 17 17 1 1 18 18 18 18 1 1 19 19 19 19 1 1 20 20 20 20 1 1 21 21 21 21 1 1 22 22 22 22 1 1 23 23 23 23 1 1 24 24 24 24 1 1 25 25 25 25 1 1 26 26 26 26 1 1 27 27 27 27 1 1 28 28 28 28 1 1 29 29 29 29 1 1 30 30 30 30 1 1 31 31 31 31 1 1 32 32 32 32 1 1 0 0 16 16 24 24 8 8 32 32 0 0 2 2 2 2 3 3 4 4 4 4 5 5 6 6 6 6 7 7 4 4 8 8 9 9 10 10 10 10 11 11 8 8 12 12 13 13 16 16 14 14 15 15 16 16 16 16 17 17 18 18 18 18 19 19 20 20 20 20 21 21 22 22 22 22 23 23 24 24 24 24 25 25 26 26 26 26 27 27 28 28 28 28 29 29 32 32 30 30 31 31 32 32 32 32 2 2 8 8 4 4 7 7 8 8 8 8 11 11 12 12 13 13 14 14 16 16 16 16 18 18 24 24 20 20 22 22 24 24 24 24 26 26 32 32 29 29 30 30 32 32 2 2 4 4 8 8 8 8 12 12 16 16 18 18 20 20 24 24 26 26 28 28 32 32 32 32 8 8 24 24</p>
</polylist>
</mesh>
</geometry>
@@ -167,21 +82,15 @@
<library_controllers/>
<library_visual_scenes>
<visual_scene id="Scene" name="Scene">
<node id="Camera" name="Camera" type="NODE">
<matrix sid="transform">0.6859207 -0.3240135 0.6515582 7.481132 0.7276763 0.3054208 -0.6141704 -6.50764 0 0.8953956 0.4452714 5.343665 0 0 0 1</matrix>
<instance_camera url="#Camera-camera"/>
</node>
<node id="Lamp" name="Lamp" type="NODE">
<matrix sid="transform">-0.2908646 -0.7711008 0.5663932 4.076245 0.9551712 -0.1998834 0.2183912 1.005454 -0.05518906 0.6045247 0.7946723 5.903862 0 0 0 1</matrix>
<instance_light url="#Lamp-light"/>
</node>
<node id="Cube" name="Cube" type="NODE">
<matrix sid="transform">1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1</matrix>
<instance_geometry url="#Cube_001-mesh" name="Cube"/>
</node>
<node id="Cone" name="Cone" type="NODE">
<matrix sid="transform">1 0 0 0 0 1 0 0 0 0 1 1.015816 0 0 0 1</matrix>
<instance_geometry url="#Cone-mesh" name="Cone"/>
<instance_geometry url="#Cone-mesh" name="Cone">
<bind_material>
<technique_common>
<instance_material symbol="Material_001-material" target="#Material_001-material"/>
</technique_common>
</bind_material>
</instance_geometry>
</node>
</visual_scene>
</library_visual_scenes>