Beispiel #1
0
    public static Exp angle2d(ExpVector d0, ExpVector d1, bool angle360 = false)
    {
        Exp nu = d1.x * d0.x + d1.y * d0.y;
        Exp nv = d0.x * d1.y - d0.y * d1.x;

        if (angle360)
        {
            return(Math.PI - Exp.Atan2(nv, -nu));
        }
        return(Exp.Atan2(nv, nu));
    }
Beispiel #2
0
    public void GenerateEquations(EquationSystem sys)
    {
        sys.AddParameters(parameters);

        sys.AddEquation(u.Magnitude() - 1.0);
        sys.AddEquation(v.Magnitude() - 1.0);

        var cross = ExpVector.Cross(u, v);
        var dot   = ExpVector.Dot(u, v);

        sys.AddEquation(Exp.Atan2(cross.Magnitude(), dot) - Math.PI / 2);
        sys.AddEquation(n - ExpVector.Cross(u, v));
    }
Beispiel #3
0
    public ExpVector PointOn(Exp a, ExpVector point)
    {
        /*
         * var ax = GetAxis();
         * var axn = ax.Normalized();
         * var o = GetOrigin();
         * var prj = ExpVector.ProjectPointToLine(point, o, o + ax);
         * var ra = Exp.Atan2(new Exp(step) / 4.0, (point - prj).Magnitude());
         */
        var ax  = GetAxis().Eval();
        var axn = ax.normalized;
        var o   = GetOrigin().Eval();
        var prj = ExpVector.ProjectPointToLine(point.Eval(), o, o + ax);

        var t   = a / (2.0 * Mathf.PI);
        var ra  = Exp.Atan2(new Exp(step) / 4.0, (point.Eval() - prj).magnitude);
        var res = ExpVector.RotateAround(point, point - prj, o, ra);

        res = ExpVector.RotateAround(res, ax, o, a);
        return(res + (ExpVector)axn * t * step);
    }
Beispiel #4
0
 public static Exp angle3d(ExpVector d0, ExpVector d1)
 {
     return(Exp.Atan2(ExpVector.Cross(d0, d1).Magnitude(), ExpVector.Dot(d0, d1)));
 }