Calls giveAngleBothMethods with bool = true.

@param  from  the atom to view from
@param  to1   first direction to look in
@param  to2   second direction to look in
@return       The angle in rad from 0 to 2*PI
484986
public static double giveAngle(IAtom from, IAtom to1, IAtom to2) {
        return (giveAngleBothMethods(from, to1, to2, true));
    }
1139626
def angle2vecs(vec1, vec2):
    """"""
    # vector a * vector b = |a|*|b|* cos(angle between vector a and vector b)
    dot = np.dot(vec1, vec2)
    vec1_modulus = np.sqrt(np.multiply(vec1, vec1).sum())
    vec2_modulus = np.sqrt(np.multiply(vec2, vec2).sum())
    if (vec1_modulus * vec2_modulus) == 0:
        cos_angle = 1
    else: cos_angle = dot / (vec1_modulus * vec2_modulus)
    return math.degrees(acos(cos_angle))
574565
function getDirectionChange(angle1, angle2) {

        var directionChange = Math.abs(angle1 - angle2);
        return (directionChange > 180) ? (360 - directionChange) : directionChange;
    }
488489
@Pure
	public final double getAngle() {
		double mag = this.x*this.x + this.y*this.y + this.z*this.z;  

		if ( mag > EPS ) {
			mag = Math.sqrt(mag);
			return (2.f*Math.atan2(mag, this.w)); 
		}
		return 0f;
	}
24325
static public Angle sum(Angle angle1, Angle angle2) {
        return new Angle(angle1.value + angle2.value);
    }
1247837
public static Interval oddsFromTo(int from, int to)
    {
        if (from % 2 == 0)
        {
            if (from < to)
            {
                from++;
            }
            else
            {
                from--;
            }
        }
        if (to % 2 == 0)
        {
            if (to > from)
            {
                to--;
            }
            else
            {
                to++;
            }
        }
        return Interval.fromToBy(from, to, to > from ? 2 : -2);
    }
440093
def pmag_angle(D1,D2): # use this 
    
    D1 = numpy.array(D1)
    if len(D1.shape) > 1:
        D1 = D1[:,0:2] # strip off intensity
    else: D1 = D1[:2]
    D2 = numpy.array(D2)
    if len(D2.shape) > 1:
        D2 = D2[:,0:2] # strip off intensity
    else: D2 = D2[:2]
    X1 = dir2cart(D1) # convert to cartesian from polar
    X2 = dir2cart(D2)
    angles = [] # set up a list for angles
    for k in range(X1.shape[0]): # single vector
        angle = numpy.arccos(numpy.dot(X1[k],X2[k]))*180./numpy.pi # take the dot product
        angle = angle%360.
        angles.append(angle)
    return numpy.array(angles)
405621
function getDirectionAngle(start, end, numDirections, grid, opt) {

        var quadrant = 360 / numDirections;
        var angleTheta = start.theta(fixAngleEnd(start, end, grid, opt));
        var normalizedAngle = g.normalizeAngle(angleTheta + (quadrant / 2));
        return quadrant * Math.floor(normalizedAngle / quadrant);
    }
660200
public function heading(Position $from, Position $to): float
    {
        $lat1 = $from->latitude();
        $lng1 = $from->longitude();
        $lat2 = $to->latitude();
        $lng2 = $to->longitude();

        $lat1 = \deg2rad($lat1);
        $lat2 = \deg2rad($lat2);
        $dLon = \deg2rad($lng2 - $lng1);

        $y = \sin($dLon) * \cos($lat2);
        $x = \cos($lat1) * \sin($lat2) -
            \sin($lat1) * \cos($lat2) * \cos($dLon);

        $heading = \atan2($y, $x);

        return \fmod(\rad2deg($heading) + 360, 360);
    }
1260735
function getRotation(start, end) {
    // need two fingers
    if (start.length >= 2 && end.length >= 2) {
      return this.getAngle(end[1], end[0]) - this.getAngle(start[1], start[0]);
    }
    return 0;
  }
202827
private double computeAngle(RoadPolyline segment, boolean fromStartPoint) {
		double angle = Double.NaN;
		Point2d p1 = null;
		Point2d p2 = null;
		if (segment.getPointCount() > 1) {
			if (fromStartPoint) {
				final RoadConnection startPoint = segment.getBeginPoint(StandardRoadConnection.class);
				if (startPoint == this) {
					p1 = startPoint.getPoint();
					p2 = segment.getPointAt(1);
					// Because the Y axis is directly to the bottom of the screen
					// it is necessary to invert it to reply an counterclockwise angle
					angle = MathUtil.clampCyclic(
							Vector2D.signedAngle(
									1, 0, p2.getX() - p1.getX(), p1.getY() - p2.getY()),
							0, MathConstants.TWO_PI);
				} else {
					throw new IllegalArgumentException(
							Locale.getString("ERROR_ALREADY_CONNECTED_START", //$NON-NLS-1$
									segment,
									p1,
									p2,
									startPoint));
				}
			} else {
				final RoadConnection endPoint = segment.getEndPoint(StandardRoadConnection.class);
				if (endPoint == this) {
					p1 = endPoint.getPoint();
					p2 = segment.getAntepenulvianPoint();
					// Because the Y axis is directly to the bottom of the screen
					// it is necessary to invert it to reply an counterclockwise angle
					angle = MathUtil.clampCyclic(
							Vector2D.signedAngle(
									1, 0, p2.getX() - p1.getX(), p1.getY() - p2.getY()),
							0, MathConstants.TWO_PI);
				} else {
					throw new IllegalArgumentException(
							Locale.getString("ERROR_ALREADY_CONNECTED_END", //$NON-NLS-1$
									segment,
									p1,
									p2,
									endPoint));
				}
			}

			if (Double.isNaN(angle) || Double.isInfinite(angle)) {
				throw new IllegalArgumentException(
						Locale.getString("ERROR_SAME_POINTS", //$NON-NLS-1$
								segment, p1, p2));
			}
		} else {
			throw new IllegalArgumentException(
					Locale.getString("ERROR_NOT_ENOUGH_POINTS", //$NON-NLS-1$
							segment));
		}

		return angle;
	}
1355141
public final double getDistanceKmToPath(Position p1, Position p2) {
		double d = radiusEarthKm
				* asin(sin(getDistanceToKm(p1) / radiusEarthKm)
						* sin(toRadians(getBearingDegrees(p1)
								- p1.getBearingDegrees(p2))));
		return abs(d);
	}
431154
def Angle(self, other):
    
    return math.atan2(self.CrossProd(other).Norm2(),
                      self.DotProd(other))
1198984
def get_angle_difference(v1, v2):
    """"""
    v1 = numpy.array(v1)
    v2 = numpy.array(v2)
    angle=numpy.arccos(old_div((numpy.dot(v1, v2) ), (numpy.sqrt(math.fsum(v1**2)) * numpy.sqrt(math.fsum(v2**2)))))    
    return math.degrees(angle)
546235
function (source, target, startAngle) {
                    // Given a point we need to find the next point clockwise from the start angle
                    var i,
                        point = target[target.length - 1],
                        thisAngle,
                        bestAngleSoFar = 9999,
                        returnPoint = point;
                    for (i = 0; i < source.length; i += 1) {
                        if (source[i].x !== point.x || source[i].y !== point.y) {
                            // get the angle in degrees since start angle
                            thisAngle = 180 - (Math.atan2(source[i].x - point.x, source[i].y - point.y) * (180 / Math.PI));
                            if (thisAngle > startAngle && thisAngle < bestAngleSoFar) {
                                returnPoint = source[i];
                                bestAngleSoFar = thisAngle;
                            }
                        }
                    }
                    target.push(returnPoint);
                    return bestAngleSoFar;
                }
1373684
def angle(v1,v2, cos=False):
    
    n = (norm(v1)*norm(v2))
    _ = dot(v1,v2)/n
    return _ if cos else N.arccos(_)
633448
public static final Point2DArray getCanvasArcToPoints(final Point2D p0, final Point2D p1, final Point2D p2, final double r)
    {
        // see tangents drawn from same point to a circle
        // http://www.mathcaptain.com/geometry/tangent-of-a-circle.html
        final double a0 = getAngleBetweenTwoLines(p0, p1, p2) / 2;

        final double ln = getLengthFromASA(RADIANS_90 - a0, r, a0);

        Point2D dv = p1.sub(p0);

        Point2D dx = dv.unit();

        Point2D dl = dx.mul(ln);

        final Point2D ps = p1.sub(dl);// ps is arc start point

        dv = p1.sub(p2);

        dx = dv.unit();

        dl = dx.mul(ln);

        final Point2D pe = p1.sub(dl);// ep is arc end point

        // this gets the direction as a unit, from p1 to the center
        final Point2D midPoint = new Point2D((ps.getX() + pe.getX()) / 2, (ps.getY() + pe.getY()) / 2);

        dx = midPoint.sub(p1).unit();

        final Point2D pc = p1.add(dx.mul(distance(r, ln)));

        return new Point2DArray(ps, pc, pe);
    }