/** * Used with serialization. Not to be called manually. * * @param in * ObjectInput * @throws IOException * @throws ClassNotFoundException */ @Override public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException { setA((Vector3) in.readObject()); setB((Vector3) in.readObject()); setC((Vector3) in.readObject()); }
/** * Used with serialization. Not to be called manually. * * @param in * ObjectInput * @throws IOException * @throws ClassNotFoundException */ @Override public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException { setA((Vector3) in.readObject()); setB((Vector3) in.readObject()); setC((Vector3) in.readObject()); }
/** * Constructor creates a new Rectangle3 with defined A, B, and C points that define the area of the rectangle. * * @param a * the first corner of the rectangle. * @param b * the second corner of the rectangle. * @param c * the third corner of the rectangle. */ public Rectangle3(final ReadOnlyVector3 a, final ReadOnlyVector3 b, final ReadOnlyVector3 c) { setA(a); setB(b); setC(c); }
/** * Constructor creates a new Rectangle3 with defined A, B, and C points that define the area of the rectangle. * * @param a * the first corner of the rectangle. * @param b * the second corner of the rectangle. * @param c * the third corner of the rectangle. */ public Rectangle3(final ReadOnlyVector3 a, final ReadOnlyVector3 b, final ReadOnlyVector3 c) { setA(a); setB(b); setC(c); }
public void stateChanged(final ChangeEvent e) { final Rectangle3 rect = ((RectangleEmitter) getEdittedParticles().getParticleEmitter()).getSource(); final double height = _rectHeightPanel.getDoubleValue(); final Vector3 helper = Vector3.fetchTempInstance(); helper.set(rect.getA()).setZ(-height / 2.0); rect.setA(helper); helper.set(rect.getB()).setZ(-height / 2.0); rect.setB(helper); helper.set(rect.getC()).setZ(height / 2.0); rect.setC(helper); Vector3.releaseTempInstance(helper); } });
public void stateChanged(final ChangeEvent e) { final Rectangle3 rect = ((RectangleEmitter) getEdittedParticles().getParticleEmitter()).getSource(); final double width = _rectWidthPanel.getDoubleValue(); final Vector3 helper = Vector3.fetchTempInstance(); helper.set(rect.getA()).setX(-width / 2.0); rect.setA(helper); helper.set(rect.getB()).setX(width / 2.0); rect.setB(helper); helper.set(rect.getC()).setX(-width / 2.0); rect.setC(helper); Vector3.releaseTempInstance(helper); } });
@Test public void testRandom() { MathUtils.setRandomSeed(0); final Rectangle3 rect1 = new Rectangle3(); final Vector3 store = rect1.random(null); assertEquals(new Vector3(0.0, 0.0, 0.0), store); rect1.setA(new Vector3(1, 0, 0)); rect1.setB(new Vector3(1, 1, 0)); rect1.setC(new Vector3(0, 1, 0)); rect1.random(store); assertEquals(new Vector3(0.39365482330322266, 0.8468815684318542, 0.0), store); } }
@Test public void testGetSet() { final Rectangle3 rect = new Rectangle3(); assertEquals(Vector3.ZERO, rect.getA()); assertEquals(Vector3.ZERO, rect.getB()); assertEquals(Vector3.ZERO, rect.getC()); rect.setA(Vector3.ONE); rect.setB(Vector3.UNIT_X); rect.setC(Vector3.UNIT_Z); assertEquals(Vector3.ONE, rect.getA()); assertEquals(Vector3.UNIT_X, rect.getB()); assertEquals(Vector3.UNIT_Z, rect.getC()); final Rectangle3 rect2 = new Rectangle3(rect); assertEquals(Vector3.ONE, rect2.getA()); assertEquals(Vector3.UNIT_X, rect2.getB()); assertEquals(Vector3.UNIT_Z, rect2.getC()); final Rectangle3 rect3 = new Rectangle3(Vector3.NEG_ONE, Vector3.UNIT_Z, Vector3.NEG_UNIT_Y); assertEquals(Vector3.NEG_ONE, rect3.getA()); assertEquals(Vector3.UNIT_Z, rect3.getB()); assertEquals(Vector3.NEG_UNIT_Y, rect3.getC()); }