private float integrateIncline( final float time) { float s = this.speed_incline; final boolean positive = this.input.isOrbitingInclinePositive(); if (positive) { s += this.acceleration_incline * time; } final boolean negative = this.input.isOrbitingInclineNegative(); if (negative) { s -= this.acceleration_incline * time; } s = Clamp.clamp(s, -this.maximum_speed_incline, this.maximum_speed_incline); /** * If applying the movement resulted in a value that was clamped, then * remove all speed in that direction by returning zero. Otherwise, the * user has to achieve a greater than or equal speed in the opposite * direction just to get the camera to appear to start moving. */ final boolean clamped = this.camera.cameraOrbitIncline(s * time); if (clamped) { return 0.0f; } return JCameraSphericalAngularIntegrator.applyDrag( s, this.drag_incline, time); }
private double integrateIncline( final double time) { double s = this.speed_incline; final boolean positive = this.input.isOrbitingInclinePositive(); if (positive) { s += this.acceleration_incline * time; } final boolean negative = this.input.isOrbitingInclineNegative(); if (negative) { s -= this.acceleration_incline * time; } s = Clamp.clamp(s, -this.maximum_speed_incline, this.maximum_speed_incline); /* * If applying the movement resulted in a value that was clamped, then * remove all speed in that direction by returning zero. Otherwise, the * user has to achieve a greater than or equal speed in the opposite * direction just to get the camera to appear to start moving. */ final boolean clamped = this.camera.cameraOrbitIncline(s * time); if (clamped) { return 0.0; } return JCameraSphericalAngularIntegrator.applyDrag( s, this.drag_incline, time); }
@Test public void testSnapshotEquality() { final JCameraSphericalType c0 = JCameraSpherical.newCamera(); c0.cameraOrbitHeading((float) (Math.random() * 100.0f)); c0.cameraOrbitIncline((float) (Math.random() * 100.0f)); c0.cameraMoveTargetRight((float) (Math.random() * 100.0f)); c0.cameraMoveTargetUp((float) (Math.random() * 100.0f)); c0.cameraMoveTargetForwardOnXZ((float) (Math.random() * 100.0f)); c0.cameraZoomOut((float) (Math.random() * 100.0f)); final JCameraSphericalType c1 = JCameraSpherical.newCameraFrom(c0); c1.cameraOrbitHeading((float) (Math.random() * 100.0f)); c1.cameraOrbitIncline((float) (Math.random() * 100.0f)); c1.cameraMoveTargetRight((float) (Math.random() * 100.0f)); c1.cameraMoveTargetUp((float) (Math.random() * 100.0f)); c1.cameraMoveTargetForwardOnXZ((float) (Math.random() * 100.0f)); c1.cameraZoomOut((float) (Math.random() * 100.0f)); System.out.println("c0: " + c0); System.out.println("c1: " + c1); final JCameraSphericalSnapshot snap_0 = c0.cameraMakeSnapshot(); final JCameraSphericalSnapshot snap_1 = c1.cameraMakeSnapshot(); Assert.assertEquals(snap_0, snap_0); Assert.assertNotEquals(snap_0, snap_1); Assert.assertNotEquals(snap_0, null); Assert.assertNotEquals(snap_0, Integer.valueOf(23)); Assert.assertEquals(snap_0.hashCode(), snap_0.hashCode()); Assert.assertNotEquals(snap_0.hashCode(), snap_1.hashCode()); Assert.assertEquals(snap_0.toString(), snap_0.toString()); Assert.assertNotEquals(snap_0.toString(), snap_1.toString()); }
c0.cameraOrbitIncline((float) (Math.random() * 100.0f)); c0.cameraMoveTargetRight((float) (Math.random() * 100.0f)); c0.cameraMoveTargetUp((float) (Math.random() * 100.0f));
c.cameraOrbitIncline((float) Math.toRadians(-89.99999));
c.cameraOrbitIncline((float) Math.toRadians(89.99999));