Search in sources :

Example 1 with Matrix4d

use of gaiasky.util.math.Matrix4d in project gaiasky by langurmonkey.

the class RecursiveGrid method initialize.

@Override
public void initialize() {
    transformName = Settings.settings.scene.visibility.get(ComponentType.Galactic.toString()) ? "galacticToEquatorial" : (Settings.settings.scene.visibility.get(ComponentType.Ecliptic.toString()) ? "eclipticToEquatorial" : null);
    coordinateSystem = new Matrix4();
    coordinateSystemd = new Matrix4d();
    mat4daux = new Matrix4d();
    scalingFading = new Pair<>(0d, 0d);
    updateCoordinateSystem();
    nf = NumberFormatFactory.getFormatter("0.###E0");
    cc = Settings.settings.scene.visibility.get(ComponentType.Galactic.toString()) ? ccGal : (Settings.settings.scene.visibility.get(ComponentType.Ecliptic.toString()) ? ccEcl : ccEq);
    labelcolor = cc;
    label = true;
    labelPosition = new Vector3b();
    localTransform = new Matrix4();
    p01 = new Vector3d();
    p02 = new Vector3d();
    d01 = -1;
    d02 = -1;
    a = new Vector3d();
    b = new Vector3d();
    c = new Vector3d();
    d = new Vector3d();
    // Init billboard model
    mc = new ModelComponent();
    mc.setType("twofacedbillboard");
    Map<String, Object> p = new HashMap<>();
    p.put("diameter", 1d);
    mc.setParams(p);
    mc.forceInit = true;
    mc.initialize(null);
    mc.env.set(new ColorAttribute(ColorAttribute.AmbientLight, cc[0], cc[1], cc[2], cc[3]));
    // Depth reads, no depth writes
    mc.setDepthTest(GL20.GL_LEQUAL, false);
    // Initialize annotations vectorR
    initAnnotations();
}
Also used : Matrix4d(gaiasky.util.math.Matrix4d) Vector3b(gaiasky.util.math.Vector3b) Vector3d(gaiasky.util.math.Vector3d) ModelComponent(gaiasky.scenegraph.component.ModelComponent) HashMap(java.util.HashMap) ColorAttribute(gaiasky.util.gdx.shader.attribute.ColorAttribute) Matrix4(com.badlogic.gdx.math.Matrix4)

Example 2 with Matrix4d

use of gaiasky.util.math.Matrix4d in project gaiasky by langurmonkey.

the class RecursiveGrid method getZXLine.

private void getZXLine(Vector3d a, Vector3d b, Vector3d cpos, Vector3d fpos) {
    Matrix4d inv = coordinateSystemd;
    a.set(-cpos.x, -cpos.y, -cpos.z);
    b.set(fpos.x, -cpos.y, fpos.z);
    // Back to equatorial
    a.mul(inv);
    b.mul(inv);
}
Also used : Matrix4d(gaiasky.util.math.Matrix4d)

Example 3 with Matrix4d

use of gaiasky.util.math.Matrix4d in project gaiasky by langurmonkey.

the class ChangeOfBasisTest method main.

public static void main(String[] args) {
    System.out.println("==========================");
    Matrix4d c = Matrix4d.changeOfBasis(new double[] { 0, 0, -1 }, new double[] { 0, 1, 0 }, new double[] { 1, 0, 0 });
    Vector3d v = new Vector3d(1, 0, 0);
    System.out.println(v + " -> " + (new Vector3d(v)).mul(c));
    v = new Vector3d(0, 1, 0);
    System.out.println(v + " -> " + (new Vector3d(v)).mul(c));
    v = new Vector3d(0, 0, 1);
    System.out.println(v + " -> " + (new Vector3d(v)).mul(c));
    System.out.println("==========================");
    c = Matrix4d.changeOfBasis(new double[] { 0.5, 0, 0 }, new double[] { -1, 2, 0 }, new double[] { 0, 0, 1 });
    v = new Vector3d(4, 1, 0);
    System.out.println(v + " -> " + (new Vector3d(v)).mul(c));
    v = new Vector3d(0, 1, 0);
    System.out.println(v + " -> " + (new Vector3d(v)).mul(c));
}
Also used : Matrix4d(gaiasky.util.math.Matrix4d) Vector3d(gaiasky.util.math.Vector3d)

Example 4 with Matrix4d

use of gaiasky.util.math.Matrix4d in project gaiasky by langurmonkey.

the class RecursiveGrid method getYLine.

private void getYLine(Vector3d a, Vector3d b, Vector3d cpos, Vector3d fpos) {
    Matrix4d inv = coordinateSystemd;
    a.set(fpos.x, -cpos.y, fpos.z);
    b.set(fpos.x, fpos.y, fpos.z);
    // Back to equatorial
    a.mul(inv);
    b.mul(inv);
}
Also used : Matrix4d(gaiasky.util.math.Matrix4d)

Example 5 with Matrix4d

use of gaiasky.util.math.Matrix4d in project gaiasky by langurmonkey.

the class OrbitLintCoordinates method doneLoading.

@Override
public void doneLoading(Object... params) {
    if (params.length == 0) {
        logger.error(new RuntimeException("OrbitLintCoordinates need the scene graph"));
    } else {
        super.doneLoading(params);
        transf = new Matrix4d();
        orbitalParams = orbit.oc;
        data = orbit.getPointCloud();
    }
}
Also used : Matrix4d(gaiasky.util.math.Matrix4d)

Aggregations

Matrix4d (gaiasky.util.math.Matrix4d)16 Vector3d (gaiasky.util.math.Vector3d)6 Matrix4 (com.badlogic.gdx.math.Matrix4)4 Method (com.badlogic.gdx.utils.reflect.Method)3 ReflectionException (com.badlogic.gdx.utils.reflect.ReflectionException)3 PointCloudData (gaiasky.data.util.PointCloudData)3 Vector3b (gaiasky.util.math.Vector3b)3 Coordinates (gaiasky.util.coord.Coordinates)2 BufferedReader (java.io.BufferedReader)2 InputStreamReader (java.io.InputStreamReader)2 Timestamp (java.sql.Timestamp)2 CameraMode (gaiasky.scenegraph.camera.CameraManager.CameraMode)1 ModelComponent (gaiasky.scenegraph.component.ModelComponent)1 OrbitComponent (gaiasky.scenegraph.component.OrbitComponent)1 RotationComponent (gaiasky.scenegraph.component.RotationComponent)1 ColorAttribute (gaiasky.util.gdx.shader.attribute.ColorAttribute)1 HashMap (java.util.HashMap)1