/** * Construct a new integrator. * * @param in_camera The camera to be integrated. * @param in_input The input to be sampled. * * @return A new integrator */ public static JCameraSphericalAngularIntegratorType newIntegrator( final JCameraSphericalType in_camera, final JCameraSphericalInputType in_input) { return new JCameraSphericalAngularIntegrator(in_camera, in_input); }
@Override public void integrate( final double time) { this.speed_heading = this.integrateHeading(time); this.speed_incline = this.integrateIncline(time); }
/** * Return a new integrator for the given camera and input using the default * integrator implementations. * * @param in_camera The camera * @param in_input The input * * @return A new integrator */ public static JCameraSphericalIntegratorType newIntegrator( final JCameraSphericalType in_camera, final JCameraSphericalInputType in_input) { final JCameraSphericalAngularIntegratorType ai = JCameraSphericalAngularIntegrator.newIntegrator(in_camera, in_input); final JCameraSphericalLinearIntegratorType li = JCameraSphericalLinearIntegrator.newIntegrator(in_camera, in_input); return JCameraSphericalIntegrator.newIntegratorWith(ai, li); }
private float integrateHeading( final float time) { float s = this.speed_heading; final boolean positive = this.input.isOrbitingHeadingPositive(); if (positive) { s += this.acceleration_heading * time; } final boolean negative = this.input.isOrbitingHeadingNegative(); if (negative) { s -= this.acceleration_heading * time; } s = Clamp.clamp(s, -this.maximum_speed_heading, this.maximum_speed_heading); this.camera.cameraOrbitHeading(s * time); return JCameraSphericalAngularIntegrator.applyDrag( s, this.drag_heading, time); }
/** * Return a new integrator for the given camera and input using the default * integrator implementations. * * @param in_camera The camera * @param in_input The input * * @return A new integrator */ public static JCameraSphericalIntegratorType newIntegrator( final JCameraSphericalType in_camera, final JCameraSphericalInputType in_input) { final JCameraSphericalAngularIntegratorType ai = JCameraSphericalAngularIntegrator.newIntegrator(in_camera, in_input); final JCameraSphericalLinearIntegratorType li = JCameraSphericalLinearIntegrator.newIntegrator(in_camera, in_input); return JCameraSphericalIntegrator.newIntegratorWith(ai, li); }
private double integrateHeading( final double time) { double s = this.speed_heading; final boolean positive = this.input.isOrbitingHeadingPositive(); if (positive) { s += this.acceleration_heading * time; } final boolean negative = this.input.isOrbitingHeadingNegative(); if (negative) { s -= this.acceleration_heading * time; } s = Clamp.clamp(s, -this.maximum_speed_heading, this.maximum_speed_heading); this.camera.cameraOrbitHeading(s * time); return JCameraSphericalAngularIntegrator.applyDrag( s, this.drag_heading, time); }
@Override @NonNull JCameraSphericalAngularIntegratorType newIntegrator( final @NonNull JCameraSphericalType c, final @NonNull JCameraSphericalInputType i) { return JCameraSphericalAngularIntegrator.newIntegrator(c, i); } }
@Override public void integrate( final float time) { this.speed_heading = this.integrateHeading(time); this.speed_incline = this.integrateIncline(time); }
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); }
/** * Construct a new integrator. * * @param in_camera The camera to be integrated. * @param in_input The input to be sampled. * * @return A new integrator */ public static JCameraSphericalAngularIntegratorType newIntegrator( final JCameraSphericalType in_camera, final JCameraSphericalInputType in_input) { return new JCameraSphericalAngularIntegrator(in_camera, in_input); }
@Test(expected = IllegalArgumentException.class) public void testInputIncorrect() { final JCameraSphericalType c = JCameraSpherical.newCamera(); final JCameraSphericalInputType i0 = JCameraSphericalInput.newInput(); final JCameraSphericalInputType i1 = JCameraSphericalInput.newInput(); final JCameraSphericalAngularIntegratorType ai = JCameraSphericalAngularIntegrator.newIntegrator(c, i0); final JCameraSphericalLinearIntegratorType li = JCameraSphericalLinearIntegrator.newIntegrator(c, i1); JCameraSphericalIntegrator.newIntegratorWith(ai, li); } }
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(expected = IllegalArgumentException.class) public void testCameraIncorrect() { final JCameraSphericalType c0 = JCameraSpherical.newCamera(); final JCameraSphericalType c1 = JCameraSpherical.newCamera(); final JCameraSphericalInputType i = JCameraSphericalInput.newInput(); final JCameraSphericalAngularIntegratorType ai = JCameraSphericalAngularIntegrator.newIntegrator(c0, i); final JCameraSphericalLinearIntegratorType li = JCameraSphericalLinearIntegrator.newIntegrator(c1, i); JCameraSphericalIntegrator.newIntegratorWith(ai, li); }
JCameraSphericalAngularIntegrator.newIntegrator( this.camera, this.input),
JCameraSphericalAngularIntegrator.newIntegrator( this.camera, this.input),