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();
}
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);
}
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));
}
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);
}
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();
}
}
Aggregations