Exemple #1
0
    Vector4 GetRotatedVertex(Axis4D axis, Vector4 v, float s, float c)
    {
        switch (axis)
        {
        case Axis4D.xy:
            return(TesseractUtils.RotateAroundXY(v, s, c));

        case Axis4D.xz:
            return(TesseractUtils.RotateAroundXZ(v, s, c));

        case Axis4D.xw:
            return(TesseractUtils.RotateAroundXW(v, s, c));

        case Axis4D.yz:
            return(TesseractUtils.RotateAroundYZ(v, s, c));

        case Axis4D.yw:
            return(TesseractUtils.RotateAroundYW(v, s, c));

        case Axis4D.zw:
            return(TesseractUtils.RotateAroundZW(v, s, c));
        }

        return(new Vector4(0, 0, 0, 0));
    }
Exemple #2
0
    public void ApplyRotationToVerts()
    {
        ResetVertices();

        foreach (RotationParams rp in rotation)
        {
            var   axis   = rp.axis;
            var   amount = rp.amount;
            float s      = Mathf.Sin(Mathf.Deg2Rad * amount);
            float c      = Mathf.Cos(Mathf.Deg2Rad * amount);
            for (int i = 0; i < rotatedVerts.Count; i++)
            {
                rotatedVerts[i] = TesseractUtils.GetRotatedVertex(axis, rotatedVerts[i], s, c);
            }
        }
    }