MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / angle

Method angle

src/org/opensourcephysics/numerics/Vec3D.java:151–160  ·  view source on GitHub ↗

Returns the angle in radians between this vector and the vector parameter; the return value is constrained to the range [0,PI]. @param v1 the other vector @return the angle in radians in the range [0,PI]

(Vec3D v1)

Source from the content-addressed store, hash-verified

149 * @return the angle in radians in the range [0,PI]
150 */
151 public final double angle(Vec3D v1) {
152 double vDot = this.dot(v1)/(this.magnitude()*v1.magnitude());
153 if(vDot<-1.0) {
154 vDot = -1.0;
155 }
156 if(vDot>1.0) {
157 vDot = 1.0;
158 }
159 return((Math.acos(vDot)));
160 }
161
162}
163

Callers

nothing calls this directly

Calls 3

dotMethod · 0.95
magnitudeMethod · 0.95
acosMethod · 0.80

Tested by

no test coverage detected