Skip to content
Snippets Groups Projects
Commit 7e952d6d authored by Xavier Gibert's avatar Xavier Gibert
Browse files

Orbit Hud rotation of Earth with frames

parent 869fe015
No related branches found
No related tags found
No related merge requests found
......@@ -300,8 +300,8 @@ function setXYplane(){
function includeEarth(){
containerEarth = new THREE.Object3D();
containerEarth.rotateX(Math.PI/2);
containerEarth.rotateZ(-23.4 * Math.PI/180);
//containerEarth.rotateX(Math.PI/2);
//containerEarth.rotateZ(-23.4 * Math.PI/180);
containerEarth.position.z = 0;
containerEarth.name = "EARTH";
scene.add(containerEarth);
......@@ -340,7 +340,9 @@ function includeEarth(){
earthMesh.name = "EARTH-PLANET";
containerEarth.add(earthMesh)
onRenderFcts.push(function(delta, now){
earthMesh.rotation.y += 1/32 * delta * accel_time;
//earthMesh.rotation.y += 1/32 * delta * accel_time;
var offset_quat = new THREE.Quaternion().setFromUnitVectors( new THREE.Vector3(0,1,0), new THREE.Vector3(0,0,1) );
earthMesh.quaternion.multiplyQuaternions(value_earth_rotation,offset_quat);
})
//Earth axis
......
package cs.si.stavor.model;
import org.apache.commons.math3.geometry.euclidean.threed.Rotation;
import org.apache.commons.math3.geometry.euclidean.threed.RotationOrder;
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
import org.orekit.attitudes.Attitude;
import org.orekit.bodies.CelestialBodyFactory;
import org.orekit.errors.OrekitException;
import org.orekit.frames.Frame;
import org.orekit.frames.FramesFactory;
import org.orekit.orbits.KeplerianOrbit;
import org.orekit.propagation.SpacecraftState;
import org.orekit.time.AbsoluteDate;
import org.orekit.time.TimeScale;
import org.orekit.time.TimeScalesFactory;
import org.orekit.utils.IERSConventions;
import org.xwalk.core.XWalkView;
import android.view.View;
......@@ -59,6 +62,9 @@ public class ModelSimulation {
if(sunFrame==null){
sunFrame = CelestialBodyFactory.getSun().getInertiallyOrientedFrame();
}
if(earthFixedFrame==null){
earthFixedFrame = CelestialBodyFactory.getEarth().getBodyOrientedFrame();
}
if(utc==null){
utc = TimeScalesFactory.getUTC();
}
......@@ -147,7 +153,7 @@ public class ModelSimulation {
private AbsoluteDate tmp_time;
private Vector3D tmp_vel;
private TimeScale utc;
private Frame sunFrame;
private Frame sunFrame, earthFixedFrame;
public void updateSimulation(SpacecraftState scs, int sim_progress){
if(selectedBrowser.equals(Browsers.Attitude)){
ModelState new_state = new ModelState();
......@@ -229,8 +235,17 @@ public class ModelSimulation {
}else if(selectedBrowser.equals(Browsers.Orbit)){
ModelStateOrbit new_state = new ModelStateOrbit();
//TODO
new_state.value_earth_rotation = new Quat();
AbsoluteDate date = scs.getAttitude().getDate();
try {
//Frame fix_frame = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
//Frame fix_frame = FramesFactory.getITRF2008(true);
Rotation rot = scs.getFrame().getTransformTo(earthFixedFrame, date).getRotation();
new_state.value_earth_rotation = new Quat(rot);
} catch (OrekitException e) {
e.printStackTrace();
}
//XGGDEBUG: correct values
Vector3D spacecraft = scs.getPVCoordinates().getPosition();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment