/** * Set base height of the waterplane(Used for reflecting the camera for rendering reflection) * * @param waterHeight * Waterplane height */ public void setWaterHeight(final double waterHeight) { waterPlane.setConstant(waterHeight); }
/** * Set base height of the waterplane(Used for reflecting the camera for rendering reflection) * * @param waterHeight * Waterplane height */ public void setWaterHeight(final double waterHeight) { waterPlane.setConstant(waterHeight); }
public void setConstant(final double constant) { _floor.setConstant(constant); }
public void setConstant(final double constant) { _floor.setConstant(constant); }
/** * 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 { setNormal((Vector3) in.readObject()); setConstant(in.readDouble()); }
/** * 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 { setNormal((Vector3) in.readObject()); setConstant(in.readDouble()); }
/** * Sets the value of this plane to the constant and normal values of the provided source plane. * * @param source * @return this plane for chaining * @throws NullPointerException * if source is null. */ public Plane set(final ReadOnlyPlane source) { setConstant(source.getConstant()); setNormal(source.getNormal()); return this; }
/** * Sets the value of this plane to the constant and normal values of the provided source plane. * * @param source * @return this plane for chaining * @throws NullPointerException * if source is null. */ public Plane set(final ReadOnlyPlane source) { setConstant(source.getConstant()); setNormal(source.getNormal()); return this; }
* _coeffLeft[1]); _worldPlane[LEFT_PLANE].setNormal(planeNormal); _worldPlane[LEFT_PLANE].setConstant(_location.dot(planeNormal)); * _coeffRight[1]); _worldPlane[RIGHT_PLANE].setNormal(planeNormal); _worldPlane[RIGHT_PLANE].setConstant(_location.dot(planeNormal)); _direction.getZ() * _coeffBottom[1]); _worldPlane[BOTTOM_PLANE].setNormal(planeNormal); _worldPlane[BOTTOM_PLANE].setConstant(_location.dot(planeNormal)); * _coeffTop[1]); _worldPlane[TOP_PLANE].setNormal(planeNormal); _worldPlane[TOP_PLANE].setConstant(_location.dot(planeNormal)); _worldPlane[LEFT_PLANE].setConstant(_worldPlane[LEFT_PLANE].getConstant() + _frustumLeft); _worldPlane[RIGHT_PLANE].setConstant(_worldPlane[RIGHT_PLANE].getConstant() - _frustumRight); } else { _worldPlane[LEFT_PLANE].setConstant(_worldPlane[LEFT_PLANE].getConstant() - _frustumLeft); _worldPlane[RIGHT_PLANE].setConstant(_worldPlane[RIGHT_PLANE].getConstant() + _frustumRight); _worldPlane[TOP_PLANE].setConstant(_worldPlane[TOP_PLANE].getConstant() + _frustumTop); _worldPlane[BOTTOM_PLANE].setConstant(_worldPlane[BOTTOM_PLANE].getConstant() - _frustumBottom); } else { _worldPlane[TOP_PLANE].setConstant(_worldPlane[TOP_PLANE].getConstant() - _frustumTop); _worldPlane[BOTTOM_PLANE].setConstant(_worldPlane[BOTTOM_PLANE].getConstant() + _frustumBottom); _worldPlane[FAR_PLANE].setConstant(-(dirDotLocation + _frustumFar));
_direction.getZ() * _coeffLeft[1]); _worldPlane[LEFT_PLANE].setNormal(planeNormal); _worldPlane[LEFT_PLANE].setConstant(_location.dot(planeNormal)); _direction.getZ() * _coeffRight[1]); _worldPlane[RIGHT_PLANE].setNormal(planeNormal); _worldPlane[RIGHT_PLANE].setConstant(_location.dot(planeNormal)); _direction.getZ() * _coeffBottom[1]); _worldPlane[BOTTOM_PLANE].setNormal(planeNormal); _worldPlane[BOTTOM_PLANE].setConstant(_location.dot(planeNormal)); _direction.getZ() * _coeffTop[1]); _worldPlane[TOP_PLANE].setNormal(planeNormal); _worldPlane[TOP_PLANE].setConstant(_location.dot(planeNormal)); _worldPlane[LEFT_PLANE].setConstant(_worldPlane[LEFT_PLANE].getConstant() + _frustumLeft); _worldPlane[RIGHT_PLANE].setConstant(_worldPlane[RIGHT_PLANE].getConstant() - _frustumRight); } else { _worldPlane[LEFT_PLANE].setConstant(_worldPlane[LEFT_PLANE].getConstant() - _frustumLeft); _worldPlane[RIGHT_PLANE].setConstant(_worldPlane[RIGHT_PLANE].getConstant() + _frustumRight); _worldPlane[TOP_PLANE].setConstant(_worldPlane[TOP_PLANE].getConstant() + _frustumTop); _worldPlane[BOTTOM_PLANE].setConstant(_worldPlane[BOTTOM_PLANE].getConstant() - _frustumBottom); } else { _worldPlane[TOP_PLANE].setConstant(_worldPlane[TOP_PLANE].getConstant() - _frustumTop); _worldPlane[BOTTOM_PLANE].setConstant(_worldPlane[BOTTOM_PLANE].getConstant() + _frustumBottom); _worldPlane[FAR_PLANE].setConstant(-(dirDotLocation + _frustumFar));
@Test public void testValid() { final Plane plane1 = new Plane(); final Plane plane2 = new Plane(new Vector3(Double.NaN, 0, 0), 0.5); final Plane plane3 = new Plane(Vector3.UNIT_X, Double.NaN); final Plane plane4 = new Plane(Vector3.UNIT_X, Double.POSITIVE_INFINITY); assertTrue(Plane.isValid(plane1)); assertFalse(Plane.isValid(plane2)); assertFalse(Plane.isValid(plane3)); assertFalse(Plane.isValid(plane4)); plane4.setConstant(1); assertTrue(Plane.isValid(plane4)); assertFalse(Plane.isValid(null)); }
@Test public void testGetSet() { final Plane plane = new Plane(); assertEquals(Vector3.UNIT_Y, plane.getNormal()); assertTrue(plane.getConstant() == 0.0); plane.setNormal(Vector3.UNIT_X); plane.setConstant(1.0); assertEquals(Vector3.UNIT_X, plane.getNormal()); assertTrue(plane.getConstant() == 1.0); final Plane plane2 = new Plane(plane); assertEquals(Vector3.UNIT_X, plane2.getNormal()); assertTrue(plane.getConstant() == 1.0); final Plane plane3 = new Plane(Vector3.NEG_UNIT_Z, 2.5); assertEquals(Vector3.NEG_UNIT_Z, plane3.getNormal()); assertTrue(plane3.getConstant() == 2.5); final Plane plane4 = new Plane().setPlanePoints(new Vector3(1, 1, 1), new Vector3(2, 1, 1), new Vector3(2, 2, 1)); assertEquals(Vector3.UNIT_Z, plane4.getNormal()); assertTrue(plane4.getConstant() == 1.0); }