public Vector3 getScale() { return scale.clone(); }
/** * Defines an elliptical orbit around a point. * * @param focalPoint Point which the {@link ATransformable3D} orbits around. * @param periapsis Point which the object passes closest to the focal point. * @param normal Normal to the orbital plane. This defines the orbital inclination. * @param eccentricity Eccentricity of the orbit. Zero value results in a circular orbit. * @param angle Double Degrees to orbit. * @param direction Direction of the orbit. */ public EllipticalOrbitAnimation3D(Vector3 focalPoint, Vector3 periapsis, Vector3 normal, double eccentricity, double angle, OrbitDirection direction) { super(); mFocalPoint = focalPoint; mPeriapsis = periapsis; mNormal = normal.clone(); mEccentricity = eccentricity; mDirection = direction; mAngle = angle; }
/** * Defines an elliptical orbit around a point. * * @param focalPoint Point which the {@link ATransformable3D} orbits around. * @param periapsis Point which the object passes closest to the focal point. * @param normal Normal to the orbital plane. This defines the orbital inclination. * @param eccentricity Eccentricity of the orbit. Zero value results in a circular orbit. * @param direction Direction of the orbit. */ public EllipticalOrbitAnimation3D(Vector3 focalPoint, Vector3 periapsis, Vector3 normal, double eccentricity, OrbitDirection direction) { super(); mFocalPoint = focalPoint; mPeriapsis = periapsis; mNormal = normal.clone(); mEccentricity = eccentricity; mDirection = direction; mAngle = 360.0; }
/** * Defines an elliptical orbit around a point. * * @param focalPoint Point which the {@link ATransformable3D} orbits around. * @param periapsis Point which the object passes closest to the focal point. * @param normal Normal to the orbital plane. This defines the orbital inclination. * @param eccentricity Eccentricity of the orbit. Zero value results in a circular orbit. * @param angle Degrees to rotate. */ public EllipticalOrbitAnimation3D(Vector3 focalPoint, Vector3 periapsis, Vector3 normal, double eccentricity, double angle) { super(); mFocalPoint = focalPoint; mPeriapsis = periapsis; mNormal = normal.clone(); mEccentricity = eccentricity; mAngle = angle; mDirection = (mAngle < 0) ? OrbitDirection.CLOCKWISE : OrbitDirection.COUNTERCLOCKWISE; mAngle = Math.abs(mAngle); }
public Vector3 getWorldPosition() { if (mParentMatrix == null) { return mPosition; } Vector3 worldPos = mPosition.clone(); worldPos.multiply(mParentMatrix); return worldPos; }
/** * Projects {@link Vector3} u onto {@link Vector3} v and creates a new * {@link Vector3} for the result. * * @param u {@link Vector3} to be projected. * @param v {@link Vector3} the {@link Vector3} to be projected on. * * @return {@link Vector3} The result of the projection. */ @NonNull public static Vector3 projectAndCreate(@NonNull Vector3 u, @NonNull Vector3 v) { double d = u.dot(v); double d_div = d / v.length2(); return v.clone().multiply(d_div); }
public SkeletonJoint(SkeletonJoint other) { mPosition = other.getPosition().clone(); mOrientation = other.getOrientation().clone(); }
Vector3 unitNormal = mNormal.clone(); unitNormal.normalize(); double uNx = Math.round(unitNormal.x * 1e8) / 1e8;
/** * Constructs a {@link ArchimedeanSpiral3D} with the specified parameters. * * @param density {@code double} Factor which determines how tightly the spiral is curled. * @param start {@link Vector3} The point where the spiral should start from. * @param normal {@link Vector3} The normal vector of the plane the spiral is in. This is assumed to be * orthogonal to the vector formed from the start to the origin. * @param spiralIn {@code boolean} True if the spiral should move from the staring point in. False to move from starting point out. */ public ASpiral3D(double density, Vector3 start, Vector3 normal, boolean spiralIn) { // Store the provided initial conditions mSpiralIn = spiralIn; mDensity = density; mStart = Vector3.subtractAndCreate(start, Vector3.ZERO); mUp = normal.clone(); // Calculate the remaining conditions mCalculateTangents = false; // Create the initial tangent vector mCurrentTangent = Vector3.crossAndCreate(mStart, mUp); // The initial rotation is 0 radians about the up axis mRotation = new Quaternion(mUp, 0); }
public Camera clone() { Camera cam = new Camera(); cam.setFarPlane(mFarPlane); cam.setFieldOfView(mFieldOfView); cam.setGraphNode(mGraphNode, mInsideGraph); cam.setLookAt(mLookAt.clone()); cam.setNearPlane(mNearPlane); cam.setOrientation(mOrientation.clone()); cam.setPosition(mPosition.clone()); cam.setProjectionMatrix(mLastWidth, mLastHeight); return cam; } }
p = c; bezierPath.addCurve(new LinearBezierCurve3D(mPreviousPoint.clone(), p)); break; case HORIZONTAL: p = c; bezierPath.addCurve(new LinearBezierCurve3D(mPreviousPoint.clone(), p)); break; case CURVE_TO: cp2.add(mPreviousPoint); mPreviousControlPoint.setAll(cp2); bezierPath.addCurve(new CubicBezierCurve3D(mPreviousPoint.clone(), cp1, cp2, p)); break; case SMOOTH_CURVE_TO: if (mCurrentCommandIsRelative) cp2.add(mPreviousPoint); bezierPath.addCurve(new CubicBezierCurve3D(mPreviousPoint.clone(), cp1, cp2, p)); break; case LINE_TO: c = new Vector3(Double.parseDouble(vals[0]), -Double.parseDouble(vals[1]), 0); p = mCurrentCommandIsRelative ? c.addAndSet(mPreviousPoint, c) : c; bezierPath.addCurve(new LinearBezierCurve3D(mPreviousPoint.clone(), p)); break; default:
private void applyRotation() { if (mIsRotating) { mapToSphere((float) mPrevScreenCoord.getX(), (float) mPrevScreenCoord.getY(), mPrevSphereCoord); mapToSphere((float) mCurrScreenCoord.getX(), (float) mCurrScreenCoord.getY(), mCurrSphereCoord); Vector3 rotationAxis = mPrevSphereCoord.clone(); rotationAxis.cross(mCurrSphereCoord); rotationAxis.normalize(); double rotationAngle = Math.acos(Math.min(1, mPrevSphereCoord.dot(mCurrSphereCoord))); mCurrentOrientation.fromAngleAxis(rotationAxis, MathUtil.radiansToDegrees(rotationAngle)); mCurrentOrientation.normalize(); Quaternion q = new Quaternion(mStartOrientation); q.multiply(mCurrentOrientation); mEmpty.setOrientation(q); } }
public void copyAllFrom(SkeletonJoint otherJoint) { this.mFlags = otherJoint.getFlags(); this.mIndex = otherJoint.getIndex(); if(otherJoint.getMatrix() != null) this.mMatrix = otherJoint.getMatrix().clone(); this.mName = otherJoint.getName(); this.mOrientation = otherJoint.getOrientation().clone(); this.mParentIndex = otherJoint.getParentIndex(); this.mPosition = otherJoint.getPosition().clone(); this.mStartIndex = otherJoint.getStartIndex(); } }
@Test public void testClone() { final Vector3 v1 = new Vector3(1d, 2d, 3d); final Vector3 v = v1.clone(); assertNotNull(v); assertFalse(v == v1); assertEquals(1d, v.x, 0); assertEquals(2d, v.y, 0); assertEquals(3d, v.z, 0); }
mPoints[i] = points[i] == null ? new Vector3() : points[i].clone(); mTmp[i] = new Vector3();
Vector3 normal = vert.normal.clone(); vert.normal.normalize();
Vector3 cameraPosition = camera.getPosition().clone(); Vector3 cameraLookAt = camera.getLookAt() != null ? camera.getLookAt().clone() : new Vector3(0, 0, 1); Vector3 cameraDirection = cameraLookAt.clone().subtract(cameraPosition); cameraDirection.normalize(); screenPosition.setAll(lensFlare.getPosition().clone()); screenPosition.multiply(viewMatrix); screenPosition.project(projMatrix); Vector3 lightToCamDirection = lensFlare.getPosition().clone().subtract(cameraPosition); lightToCamDirection.normalize(); double angleLightCamera = lightToCamDirection.dot(cameraDirection);
Vector3 lightDirection = light.getDirectionVector().clone(); lightDirection.normalize(); Vector3 lightPosition = Vector3.subtractAndCreate(mFrustumCentroid, Vector3.multiplyAndCreate(lightDirection, distance));