Esempio n. 1
0
File: Plane.cs Progetto: tom95/godot
        public Plane normalized()
        {
            float len = normal.length();

            if (len == 0)
            {
                return(new Plane(0, 0, 0, 0));
            }

            return(new Plane(normal / len, d / len));
        }
Esempio n. 2
0
File: Quat.cs Progetto: tuga3d/godot
        public Quat(Vector3 axis, float angle)
        {
            float d = axis.length();

            if (d == 0f)
            {
                x = 0f;
                y = 0f;
                z = 0f;
                w = 0f;
            }
            else
            {
                float s = Mathf.sin(-angle * 0.5f) / d;

                x = axis.x * s;
                y = axis.y * s;
                z = axis.z * s;
                w = Mathf.cos(-angle * 0.5f);
            }
        }