Exemple #1
0
    /// <summary>
    /// Converts the toric representation to world coordinates
    /// </summary>
    /// <returns>Vector3 in world coordinates</returns>
    public Vector3 ToWorldPosition()
    {
        Vector3 C;
        float   last = (vecAB.magnitude * Mathf.Sin(_alpha.toRad() + _theta.toRad() / 2)) / Mathf.Sin(_alpha.toRad());

        Vector3 n = -vecAB;

        n = n.normalized;

        Vector2 n2 = new Vector2(n.x, n.z);

        float tmp = n2[0];

        n2[0] = -n2[1];
        n2[1] = tmp;

        Vector3 z = new Vector3(n2.x, 0, n2.y);

        z = z.normalized;

        Vector3 t = Vector3.Cross(z, n);

        //horizontal rotation
        Quaternion qT = Quaternion.AngleAxis(_theta.angle() / 2, t.normalized);

        //vertical rotation
        Quaternion qP = Quaternion.AngleAxis(_phi.angle(), n);

        Vector3 res = qP * qT * vecAB;

        C = res * last / vecAB.magnitude + A;
        return(C);
    }
Exemple #2
0
    private Quaternion computeTiltAngle(float tilt)
    {
        FixAngle phi = new FixAngle(tilt);

        return(Quaternion.AngleAxis(phi.angle(), _mainCamera.transform.forward));
    }
Exemple #3
0
 //Returns the maximum value of theta for a given alpha
 public float getMaxTheta()
 {
     return(2 * (180 - _alpha.angle()));
 }