示例#1
0
文件: Plane.cs 项目: 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));
        }
示例#2
0
文件: Quat.cs 项目: 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);
            }
        }