/* (non-Javadoc)
@see org.joml.Quaternionfc#angle()
170650
public float angle() {
        float angle = (float) (2.0 * Math.acos(w));
        return (float) (angle <= Math.PI ? angle : Math.PI + Math.PI - angle);
    }
1261137
public Angle turn(Angle angle)
    {
        if (angle.getRadians() < Math.PI)
        {
            return add(angle, true);
        }
        else
        {
            return add(angle.toHalfAngle(), false);
        }
    }
1121396
public float angle(Vector2fc v) {
        float dot = x*v.x() + y*v.y();
        float det = x*v.y() - y*v.x();
        return (float) Math.atan2(det, dot);
    }
62567
public float angle(Vector4fc v) {
        float cos = angleCos(v);
        // This is because sometimes cos goes above 1 or below -1 because of lost precision
        cos = cos < 1 ? cos : 1;
        cos = cos > -1 ? cos : -1;
        return (float) Math.acos(cos);
    }
134310
public double angle(Vector3dc v) {
        double cos = angleCos(v);
        // This is because sometimes cos goes above 1 or below -1 because of lost precision
        cos = cos < 1 ? cos : 1;
        cos = cos > -1 ? cos : -1;
        return Math.acos(cos);
    }
1240826
public void rotate(Quaternion rotation) {
		Transform3D m = new Transform3D();
		m.setRotation(rotation);
		m.transform(this.getSegmentVector());
		this.getSegmentVector().normalize();
	}
474126
public Vector setAngle (double angle) {
        double l = length();
        return set(l * Math.cos(angle), l * Math.sin(angle));
    }
1319750
public void setConeInnerAngle (float angle)
    {
        if (_coneInnerAngle != angle) {
            AL10.alSourcef(_id, AL10.AL_CONE_INNER_ANGLE, _coneInnerAngle = angle);
        }
    }
578197
public void normalize() {

        double angle = this.getAngle();
        if (Utils.within(angle, 0, 1) || Utils.within(angle, 180, 1)) { // almost horizontal
            this.setLine(this.x1, this.y1, this.x2, this.y1);
        }
        else if (Utils.within(angle, 90, 1) || Utils.within(angle, 270, 1)) { // almost vertical
            this.setLine(this.x1, this.y1, this.x1, this.y2);
        }
//        else {
//            System.out.println("oblique: " + this + " ("+ this.getAngle() + ")");
//        }
    }
399134
public void rotate(double angle)
    {
        final double x2 = x + width;
        final double y2 = y;

        final double x3 = x2;
        final double y3 = y + height;

        final double x4 = x;
        final double y4 = y3;

        final double cx = x + width / 2.0;
        final double cy = y + height / 2.0;

        final double a = UtilMath.wrapDouble(angle, 0, 360);
        final double cos = UtilMath.cos(a);
        final double sin = UtilMath.sin(a);

        final double rx1 = cos * (x - cx) - sin * (y - cy) + cx;
        final double ry1 = sin * (x - cx) + cos * (y - cy) + cy;

        final double rx2 = cos * (x2 - cx) - sin * (y2 - cy) + cx;
        final double ry2 = sin * (x2 - cx) + cos * (y2 - cy) + cy;

        final double rx3 = cos * (x3 - cx) - sin * (y3 - cy) + cx;
        final double ry3 = sin * (x3 - cx) + cos * (y3 - cy) + cy;

        final double rx4 = cos * (x4 - cx) - sin * (y4 - cy) + cx;
        final double ry4 = sin * (x4 - cx) + cos * (y4 - cy) + cy;

        final double nx1 = Math.min(Math.min(Math.min(rx1, rx2), rx3), rx4);
        final double ny1 = Math.max(Math.max(Math.max(ry1, ry2), ry3), ry4);

        final double nx2 = Math.max(Math.max(Math.max(rx1, rx2), rx3), rx4);

        final double ny3 = Math.min(Math.min(Math.min(ry1, ry2), ry3), ry4);

        x = nx1;
        y = ny3;
        width = nx2 - nx1;
        height = ny1 - ny3;
    }
1355866
def angle(self, v):
        ''''''
        return acos((self * v) / (self.length() * v.length()))
1333322
public Quaterniond fromAxisAngleRad(Vector3dc axis, double angle) {
        return fromAxisAngleRad(axis.x(), axis.y(), axis.z(), angle);
    }
941359
public static float Angle(float x, float y) {
        if (y >= 0) {
            if (x >= 0)
                return (float) Math.atan(y / x);
            return (float) (Math.PI - Math.atan(-y / x));
        } else {
            if (x >= 0)
                return (float) (2 * Math.PI - Math.atan(-y / x));
            return (float) (Math.PI + Math.atan(y / x));
        }
    }
12464
public double angleTo(LineSegment other) {
        double angle1 = Math.atan2(this.start.y - this.end.y, this.start.x - this.end.x);
        double angle2 = Math.atan2(other.start.y - other.end.y, other.start.x - other.end.x);
        double angle = Math.toDegrees(angle1 - angle2);
        if (angle <= -180) {
            angle += 360;
        }
        if (angle >= 180) {
            angle -= 360;
        }
        return angle;
    }
1011245
function angle(v) {
         return Math.acos(me.Math.clamp(this.dotProduct(v) / (this.length() * v.length()), -1, 1));
       }
717062
def axis_angle(self):
        
        qw, qx, qy, qz = self.quaternion
        theta = 2 * np.arccos(qw)
        omega = np.array([1,0,0])
        if theta > 0:
            rx = qx / np.sqrt(1.0 - qw**2)
            ry = qy / np.sqrt(1.0 - qw**2)
            rz = qz / np.sqrt(1.0 - qw**2)
            omega = np.array([rx, ry, rz])
        return theta * omega
392982
private static double[] angleToCbCr(double angle) {
        double cb = Math.cos(angle);
        double cr = Math.sin(angle);

        double acb = Math.abs(cb);
        double acr = Math.abs(cr);
        double factor;
        if (acr > acb) {
            factor = 0.5 / acr;
        } else {
            factor = 0.5 / acb;
        }

        cb *= factor;
        cr *= factor;

        return new double[] {cb, cr};
    }