Vector3 implements ReadonlyVector3, Animates<ReadonlyVector3>, Serializable { public Vector3 setFromYawPitch(double yaw, double pitch) { x = Math.sin(yaw)*Math.cos(pitch); y = Math.sin(pitch); z = Math.cos(yaw)*Math.cos(pitch); return this; } Vector3();  Vector3(double x, double y, double z);  Vector3(ReadonlyVector3 other); @Override Vector3 copy(); @Override double getX(); @Override double getY(); @Override double getZ(); @Override double getComponent(Axis axis); @Override boolean componentEquals(Axis axis, double value, double epsilon); @Override boolean equalsExact(ReadonlyVector3 other); @Override boolean equalsExact(double otherX, double otherY, double otherZ); @Override boolean equals(ReadonlyVector3 other, double epsilon); @Override boolean equals(double otherX, double otherY, double otherZ, double epsilon); @Deprecated @Override boolean equals(Object other); @Override int hashCode(); @Override String toString(); @Override boolean isZero(); @Override double lengthSquared(); @Override double length(); @Override double distanceSquared(ReadonlyVector3 other); @Override @Deprecated double getDistanceSquared(ReadonlyVector3 other); @Override double distance(ReadonlyVector3 other); @Override @Deprecated double getDistance(ReadonlyVector3 other); @Override double dot(ReadonlyVector3 other); @Override double angle(ReadonlyVector3 other); @Override double angleDegrees(ReadonlyVector3 other); @Override double yaw(); @Override double yawDegrees(); @Override double pitch(); @Override double pitchDegrees(); @Override boolean isInAABB(ReadonlyVector3 lowerCorner, ReadonlyVector3 upperCorner); @Override boolean isInSphere(ReadonlyVector3 origin, double radius); @Override void glApplyRotateDegrees(double angleDegrees); @Override void glApplyRotateRadians(double angleRadians); @Override void glApplyScale(); @Override void glApplyTranslate(); Vector3 set(double x, double y, double z); Vector3 set(ReadonlyVector3 other); Vector3 setX(double x); Vector3 setY(double y); Vector3 setZ(double z); Vector3 setComponent(Axis axis, double value); Vector3 swapComponents(); Vector3 addX(double xAmount); Vector3 addY(double yAmount); Vector3 addZ(double zAmount); Vector3 addComponent(Axis axis, double amount); Vector3 add(double xAmount, double yAmount, double zAmount); Vector3 add(ReadonlyVector3 other); Vector3 subtract(ReadonlyVector3 other); Vector3 zero(); Vector3 setRandom(); Vector3 setMinimum(ReadonlyVector3 a, ReadonlyVector3 b); Vector3 setMaximum(ReadonlyVector3 a, ReadonlyVector3 b); Vector3 setFromYawPitch(double yaw, double pitch); Vector3 setFromYawPitchDegrees(double yawDegrees, double pitchDegrees); Vector3 scale(double factor); Vector3 scaleX(double factor); Vector3 scaleY(double factor); Vector3 scaleZ(double factor); Vector3 scaleComponent(Axis axis, double factor); Vector3 negate(); Vector3 absolute(); Vector3 clamp(double min, double max); Vector3 clampX(double min, double max); Vector3 clampY(double min, double max); Vector3 clampZ(double min, double max); Vector3 clampComponent(Axis axis, double min, double max); Vector3 truncate(); Vector3 floor(); Vector3 ceiling(); Vector3 round(); Vector3 midpoint(ReadonlyVector3 other); Vector3 interpolate(ReadonlyVector3 other, double alpha); Vector3 cross(ReadonlyVector3 other); Vector3 normalize(); @Override boolean isAnimating(); @Override Vector3 animateStop(); @Override Vector3 animateStart(ReadonlyVector3 toVector, long durationMs); Vector3 animateStart(double toX, double toY, double toZ, long durationMs); @Override Vector3 animateStartLoop(ReadonlyVector3 toVector, boolean reverse, long durationMs); Vector3 animateStartLoop(double toX, double toY, double toZ, boolean reverse, long durationMs); static final ReadonlyVector3 ZEROS; }
@Test public void testSetFromYawPitch() { Vector3 v = Vector3.ZEROS.copy(); assertVectorEquals(0, 1, 0, v.setFromYawPitchDegrees(0.0, 90.0)); assertVectorEquals(0, -1, 0, v.setFromYawPitchDegrees(0.0, -90.0)); assertVectorEquals(0, -1, 0, v.setFromYawPitchDegrees(0.0, 270.0)); assertVectorEquals(0, 0, 1, v.setFromYawPitchDegrees(0.0, 0.0)); assertVectorEquals(0, 0, 1, v.setFromYawPitchDegrees(0.0, 360.0)); assertVectorEquals(0, 0, 1, v.setFromYawPitchDegrees(360.0, 0.0)); assertVectorEquals(0, 0, 1, v.setFromYawPitchDegrees(-360.0, 0.0)); assertVectorEquals(0, 0, 1, v.setFromYawPitchDegrees(720.0, 0.0)); assertVectorEquals(1, 0, 0, v.setFromYawPitchDegrees(90.0, 0.0)); assertVectorEquals(0, 0, -1, v.setFromYawPitchDegrees(180.0, 0.0)); assertVectorEquals(-1, 0, 0, v.setFromYawPitchDegrees(270.0, 0.0)); assertVectorEquals(-1, 0, 0, v.setFromYawPitchDegrees(-90.0, 0.0)); final double D = 0.7071067811865475; assertVectorEquals(0, D, D, v.setFromYawPitchDegrees(0.0, 45.0)); assertVectorEquals(D, D, 0, v.setFromYawPitchDegrees(90.0, 45.0)); assertVectorEquals(0, D, -D, v.setFromYawPitchDegrees(180.0, 45.0)); }