com.supermap.data

类 Vector3D

  • 所有已实现的接口:
    Serializable


    public class Vector3D
    extends Point3D
    三维向量类。

    用于表示精度为 double 的三维向量结构。用于表示坐标值精度为 double 的三维向量对象,即其坐标值大致范围为±5.0*1e-324到±1.7*1e308,有效位为15-16位。

    当使用默认构造函数创建一个 Vector3D 对象时,其 X,Y,Z 坐标为(1,0,0);还可以使用给定 X,Y,Z 坐标的方式,和创建已有三维矢量的拷贝的方式来构造一个新的三维矢量对象。

    该类除提供返回和设置三维向量的坐标值的方法外,还提供了三维向量的基础运算,包括但不限于向量的加、减、点乘、叉乘等运算。

    另请参阅:
    序列化表格
    • 字段详细资料

      • ZERO

        public static final Vector3D ZERO
      • AXISX

        public static final Vector3D AXISX
      • AXISY

        public static final Vector3D AXISY
      • AXISZ

        public static final Vector3D AXISZ
    • 构造器详细资料

      • Vector3D

        public Vector3D()
      • Vector3D

        public Vector3D(double x,
                        double y,
                        double z)
        根据给定的 向量分量 构造一个新的三维向量对象。
        参数:
        x - x方向分量
        y - y方向分量
        z - z方向分量
      • Vector3D

        public Vector3D(Point3D pt)
        根据给定的 三维点对象 构造一个新的三维向量对象。
        参数:
        pt - 三维点对象
      • Vector3D

        public Vector3D(Point2D pt)
        根据给定的 二维点对象 构造一个新的三维向量对象(Z方向分量为0)。
        参数:
        pt - 二维点对象
      • Vector3D

        public Vector3D(Vector3D other)
        根据给定的 三维向量 构造一个新的三维向量对象。
        参数:
        other - 三维向量对象
    • 方法详细资料

      • getAt

        public double getAt(int index)
        返回此三维向量指定分量值。
        参数:
        index - 指定分量索引,应在[0,2],对应x y z三分量
        返回:
        分量值。
        抛出:
        IndexOutOfBoundsException
      • subtract

        public Vector3D subtract(Point3D other)
        返回当前向量减other向量的新向量。
        参数:
        other - 第二操作对象,可以是Point3D或Vector3D。
        返回:
        新向量。
      • subtractEquals

        public void subtractEquals(Point3D other)
        当前向量减other向量,改变自身。
        参数:
        other - 第二操作对象,可以是Point3D或Vector3D。
      • multiply

        public Vector3D multiply(double dScale)
        返回当前向量缩放dScale倍的新向量
        参数:
        dScale - 缩放系数
        返回:
        新向量
      • multiplyEquals

        public void multiplyEquals(double dScale)
        当前向量缩放dScale倍,改变自身。
        参数:
        dScale - 缩放系数。
      • multiply

        public Vector3D multiply(Matrix matrix)
        返回当前向量矩阵变换后的新向量。
        参数:
        matrix - 变换矩阵。
        返回:
        新向量。
      • multiplyEquals

        public void multiplyEquals(Matrix matrix)
        当前向量矩阵变换。
        参数:
        matrix - 变换矩阵。
      • getNormalized

        public Vector3D getNormalized()
        返回当前向量单位化的新向量。
        返回:
        新向量。
      • normalized

        public void normalized()
        当前向量单位化。
      • add

        public Vector3D add(Point3D other)
        返回当前向量加上other后新向量。
        参数:
        other - 可以是Point3D或Vector3D
        返回:
        新向量。
      • addEquals

        public void addEquals(Point3D other)
        当前向量加上other,改变自身。
        参数:
        other - 可以是Point3D或Vector3D
      • divide

        public Vector3D divide(double dScale)
        返回当前向量除以dScale后的新向量。
        参数:
        dScale - 缩放系数
        返回:
        新向量。
        抛出:
        ArithmeticException
      • divideEquals

        public void divideEquals(double dScale)
        当前向量除以dScale。
        参数:
        dScale - 缩放系数
        抛出:
        ArithmeticException
      • crossProduct

        public Vector3D crossProduct(Vector3D other)
        返回当前向量与other向量后叉乘后的新向量。
        参数:
        other - other向量
        返回:
        新向量。
      • dotProduct

        public double dotProduct(Vector3D other)
        返回当前向量与other向量后点乘乘后值。
        参数:
        other - other向量
        返回:
        向量积。
      • getLength

        public double getLength()
        返回当前向量的模。
        返回:
        模长。
      • getLengthSquared

        public double getLengthSquared()
        返回当前向量的模的平方。
        返回:
        模长。
      • distance

        public double distance(Vector3D other)
        返回当前向量与other向量的距离。
        参数:
        other - other向量
        返回:
        距离。
      • angle

        public double angle(Vector3D other)
        返回当前向量与other向量的无符号角度(角度制)。
        参数:
        other - other向量
        返回:
        角度。
      • angle

        public static double angle(Vector3D v1,
                                   Vector3D v2)
        返回v1向量与v2向量的无符号角度(角度制)。
        参数:
        v1 - other向量
        v2 - other向量
        返回:
        角度。
      • distance

        public static double distance(Point3D p1,
                                      Point3D p2)
        返回p1与p2的距离
        参数:
        p1 - 可以是Point3D也可以是Vector3D。
        p2 - 可以是Point3D也可以是Vector3D。
        返回:
        距离。
      • add

        public static Vector3D add(Vector3D v1,
                                   Vector3D v2)
        返回v1向量与v2向量的和向量。
        参数:
        v1 - 向量1。
        v1 - 向量2。
        返回:
        和向量。
      • substract

        public static Vector3D substract(Vector3D v1,
                                         Vector3D v2)
        返回v1向量与v2向量的差向量。
        参数:
        v1 - 向量1。
        v1 - 向量2。
        返回:
        差向量。
      • multiply

        public static Vector3D multiply(Vector3D v1,
                                        double dScale)
        返回v1向量乘dScale的新向量
        参数:
        v1 - 向量1。
        dScale - 系数。
        返回:
        新向量。
      • divide

        public static Vector3D divide(Vector3D v1,
                                      double dScale)
        返回v1向量除dScale的新向量
        参数:
        v1 - 向量1。
        dScale - 系数,dScale不能为零。
        返回:
        新向量。
        抛出:
        ArithmeticException
      • dotProduct

        public static double dotProduct(Vector3D v1,
                                        Vector3D v2)
        返回v1向量点乘v2向量的值
        参数:
        v1 - 向量1。
        v2 - 向量2。
        返回:
        点乘值。
      • crossProduct

        public static Vector3D crossProduct(Vector3D v1,
                                            Vector3D v2)
        返回v1向量叉乘v2向量的新向量
        参数:
        v1 - 向量1。
        v2 - 向量2。
        返回:
        新向量。
      • multiply

        public static Vector3D multiply(Vector3D v,
                                        Matrix matrix)
        返回v向量矩阵变换后的新向量
        参数:
        v - 向量1。
        matrix - 变换矩阵。
        返回:
        新向量。

Copyright © 2021–2024 SuperMap. All rights reserved.