示例#1
0
    /// <summary>
    /// 围绕某点旋转, 角度的单位为弧度
    /// </summary>
    /// <returns>The around.</returns>
    /// <param name="point">Point.</param>
    /// <param name="axis">Axis.</param>
    /// <param name="angle">Angle.</param>
    static public Vector3 RotateAround(this Vector3 position, Vector3 point, Vector3 axis, float angle)
    {
        Vector3    vector   = position;
        Quaternion rotation = VectorMath.AngleAxis(angle, axis);
        Vector3    vector2  = vector - point;

        vector2  = rotation * vector2;
        vector   = point + vector2;
        position = vector;

        return(position);
    }