org.jscience.mathematics.geometry
Class Vector3D

java.lang.Object
  extended by org.jscience.mathematics.geometry.GeometryElement
      extended by org.jscience.mathematics.geometry.AbstractVector
          extended by org.jscience.mathematics.geometry.Vector3D
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
HomogeneousVector3D, LiteralVector3D

public abstract class Vector3D
extends AbstractVector

�R�����̃x�N�g����\����?ۃN���X?B

See Also:
Point3D, Serialized Form

Field Summary
static Vector3D minusI
          Opposite of the first canonical vector (coordinates : -1, 0, 0).
static Vector3D minusJ
          Opposite of the second canonical vector (coordinates : 0, -1, 0).
static Vector3D minusK
          Opposite of the third canonical vector (coordinates : 0, 0, -1).
static Vector3D plusI
          First canonical vector (coordinates : 1, 0, 0).
static Vector3D plusJ
          Second canonical vector (coordinates : 0, 1, 0).
static Vector3D plusK
          Third canonical vector (coordinates : 0, 0, 1).
static Vector3D xUnitVector
          �R�����̃O�??
static Vector3D yUnitVector
          �R�����̃O�??
static Vector3D zeroVector
          �R�����̃[�?
static Vector3D zUnitVector
          �R�����̃O�??
 
Constructor Summary
protected Vector3D()
          �I�u�W�F�N�g��?
protected Vector3D(boolean confirmedAsUnitized)
          �I�u�W�F�N�g��?
 
Method Summary
 Vector3D add(Vector3D mate)
          �x�N�g�����m�̘a��Ԃ�?
 double angleWith(Vector3D mate, Vector3D norm)
          ���̃x�N�g���Ƃ̊p�x (���W�A��) ��?
 Vector3D crossProduct(Vector3D mate)
          �O?
 int dimension()
          ������Ԃ�?
 Vector3D divide(double scale)
          �^����ꂽ�X�P?
 double dotProduct(Vector3D mate)
          ��?
protected abstract  Vector3D doTransformBy(boolean reverseTransform, CartesianTransformationOperator3D transformationOperator, java.util.Hashtable transformedGeometries)
          ���̃x�N�g����?
 Double3Vector getDouble3Vector()
           
 boolean identical(Vector3D mate)
          ��x�N�g���̓���?
 boolean identicalDirection(Vector3D mate)
          ��x�N�g���̓�����?
 boolean is3D()
          �R�������ۂ���Ԃ�?
 Vector3D multiply(double scale)
          �^����ꂽ�X�P?
 double norm()
          �x�N�g���̃m������Ԃ�?
static LiteralVector3D of(double[] components)
          LiteralVector3D �̃C���X�^���X��?
static LiteralVector3D of(double x, double y, double z)
          LiteralVector3D �̃C���X�^���X��?
 Vector3D orthogonal()
          Get a vector orthogonal to the instance.
 boolean parallelDirection(Vector3D mate)
          ��x�N�g���̓�����?
 Vector3D project(Vector3D dNorm)
          �x�N�g���𕽖ʂɓ��e����?
 Vector3D reverse()
          �e?
 Vector3D reverseTransformBy(CartesianTransformationOperator3D transformationOperator, java.util.Hashtable transformedGeometries)
          ���̃x�N�g����?
 Vector3D subtract(Vector3D mate)
          �x�N�g�����m��?
 double[] toDoubleArray()
          double�̔z��ɕϊ�����?
 Point3D toPoint3D()
          �R�����̓_ (Point3D) �ɕϊ�����?
static Point3D[] toPoint3D(Vector3D[] vecs)
          �x�N�g���̔z���R�����̓_ (Point3D) �̔z��ɕϊ�����?
 Vector3D transformBy(boolean reverseTransform, CartesianTransformationOperator3D transformationOperator, java.util.Hashtable transformedGeometries)
          ���̃x�N�g����?
 Vector3D transformBy(CartesianTransformationOperator3D transformationOperator, java.util.Hashtable transformedGeometries)
          ���̃x�N�g����?
 Vector3D unitized()
          �P�ʉ������x�N�g����Ԃ�?
 Vector3D verticalVector()
          ������?
abstract  double x()
          �x�N�g���� X ?
static Vector3D xUnitVector()
          �R�����̃O�??
abstract  double y()
          �x�N�g���� Y ?
static Vector3D yUnitVector()
          �R�����̃O�??
abstract  double z()
          �x�N�g���� Z ?
static Vector3D zeroVector()
          �R�����̃[�?
static Vector3D zUnitVector()
          �R�����̃O�??
 
Methods inherited from class org.jscience.mathematics.geometry.AbstractVector
isVector, length, magnitude
 
Methods inherited from class org.jscience.mathematics.geometry.GeometryElement
getClassName, getToleranceForAngle, getToleranceForAngleAsObject, getToleranceForDistance, getToleranceForDistance2, getToleranceForDistanceAsObject, getToleranceForParameter, getToleranceForParameterAsObject, getToleranceForRealNumber, getToleranceForRealNumberAsObject, is1D, is2D, isCurve, isFreeform, isParametric, isPlacement, isPoint, isSurface, isTransformationOperator, makeIndent, output, output
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

plusI

public static final Vector3D plusI
First canonical vector (coordinates : 1, 0, 0). Same as xUnitVector. This is really an literalVector3D, hence it can't be changed in any way.


minusI

public static final Vector3D minusI
Opposite of the first canonical vector (coordinates : -1, 0, 0). This is really an literalVector3D, hence it can't be changed in any way.


plusJ

public static final Vector3D plusJ
Second canonical vector (coordinates : 0, 1, 0). Same as yUnitVector. This is really an literalVector3D, hence it can't be changed in any way.


minusJ

public static final Vector3D minusJ
Opposite of the second canonical vector (coordinates : 0, -1, 0). This is really an literalVector3D, hence it can't be changed in any way.


plusK

public static final Vector3D plusK
Third canonical vector (coordinates : 0, 0, 1). Same as zUnitVector. This is really an literalVector3D, hence it can't be changed in any way.


minusK

public static final Vector3D minusK
Opposite of the third canonical vector (coordinates : 0, 0, -1). This is really an literalVector3D, hence it can't be changed in any way.


zeroVector

public static final Vector3D zeroVector
�R�����̃[�?�x�N�g��?B


xUnitVector

public static final Vector3D xUnitVector
�R�����̃O�??[�o���Ȓ���?W�n�� X �����̒P�ʃx�N�g��?B


yUnitVector

public static final Vector3D yUnitVector
�R�����̃O�??[�o���Ȓ���?W�n�� Y �����̒P�ʃx�N�g��?B


zUnitVector

public static final Vector3D zUnitVector
�R�����̃O�??[�o���Ȓ���?W�n�� Z �����̒P�ʃx�N�g��?B

Constructor Detail

Vector3D

protected Vector3D()
�I�u�W�F�N�g��?\�z����?B

?�?����悤�Ƃ���x�N�g���� �P�ʃx�N�g���ł��邩�ǂ���������Ȃ�?�?�?A�µ���� �P�ʃx�N�g���łȂ����Ƃ���?؂���Ă���?�?��ɂ�?A ���̃R���X�g���N�^��g�p����?B


Vector3D

protected Vector3D(boolean confirmedAsUnitized)
�I�u�W�F�N�g��?\�z����?B

?�?����悤�Ƃ���x�N�g���� �P�ʃx�N�g���ł��邩�ǂ���������?�?��ɂ�?A ���̃R���X�g���N�^��g�p����?B

Parameters:
confirmedAsUnitized - ?�?����悤�Ƃ���x�N�g���� �P�ʃx�N�g���ł���Ȃ�� true?A ����Ȃ��� false
Method Detail

zeroVector

public static Vector3D zeroVector()
�R�����̃[�?�x�N�g����Ԃ�?B

Returns:
�R�����̃[�?�x�N�g��

xUnitVector

public static Vector3D xUnitVector()
�R�����̃O�??[�o���Ȓ���?W�n�� X �����̒P�ʃx�N�g����Ԃ�?B

Returns:
�R�����̃O�??[�o���Ȓ���?W�n�� X �����̒P�ʃx�N�g��

yUnitVector

public static Vector3D yUnitVector()
�R�����̃O�??[�o���Ȓ���?W�n�� Y �����̒P�ʃx�N�g����Ԃ�?B

Returns:
�R�����̃O�??[�o���Ȓ���?W�n�� Y �����̒P�ʃx�N�g��

zUnitVector

public static Vector3D zUnitVector()
�R�����̃O�??[�o���Ȓ���?W�n�� Z �����̒P�ʃx�N�g����Ԃ�?B

Returns:
�R�����̃O�??[�o���Ȓ���?W�n�� Z �����̒P�ʃx�N�g��

dimension

public int dimension()
������Ԃ�?B

?�� 3 ��Ԃ�?B

Specified by:
dimension in class GeometryElement
Returns:
�R�����Ȃ̂�?A?�� 3

is3D

public boolean is3D()
�R�������ۂ���Ԃ�?B

?�� true ��Ԃ�?B

Overrides:
is3D in class GeometryElement
Returns:
�R�����Ȃ̂�?A?�� true

getDouble3Vector

public Double3Vector getDouble3Vector()

x

public abstract double x()
�x�N�g���� X ?�����Ԃ���?ۃ?�\�b�h?B

Returns:
�x�N�g���� X ?���

y

public abstract double y()
�x�N�g���� Y ?�����Ԃ���?ۃ?�\�b�h?B

Returns:
�x�N�g���� Y ?���

z

public abstract double z()
�x�N�g���� Z ?�����Ԃ���?ۃ?�\�b�h?B

Returns:
�x�N�g���� Z ?���

unitized

public Vector3D unitized()
�P�ʉ������x�N�g����Ԃ�?B

������?���Ȃ��x�N�g���ɑ΂��Ă��̃?�\�b�h��Ă�?�?�?A �����ł̓[�?�x�N�g����Ԃ��悤�ɂȂBĂ���?B ������?A�{���͗�O ZeroLengthException �𓊂���ׂ��ł���?B

Returns:
�P�ʉ������x�N�g��

reverse

public Vector3D reverse()
�e?����̕�?��𔽓]�������x�N�g����Ԃ�?B

Returns:
this �𔽓]�����x�N�g��

verticalVector

public Vector3D verticalVector()
������?����ȃx�N�g����?���ɑI��ŕԂ�?B

Returns:
this ��?����ȃx�N�g��

dotProduct

public double dotProduct(Vector3D mate)
��?ς�Ԃ�?B

Parameters:
mate - ��?ς��鑊��̃x�N�g��
Returns:
��?�

crossProduct

public Vector3D crossProduct(Vector3D mate)
�O?ς�Ԃ�?B

Parameters:
mate - �O?ς��鑊��̃x�N�g��
Returns:
mate �Ƃ̊O?�

add

public Vector3D add(Vector3D mate)
�x�N�g�����m�̘a��Ԃ�?B

Parameters:
mate - �a���鑊��̃x�N�g��
Returns:
�x�N�g���̘a (this + mate)

subtract

public Vector3D subtract(Vector3D mate)
�x�N�g�����m��?���Ԃ�?B

Parameters:
mate - ?����鑊��̃x�N�g��
Returns:
�x�N�g����?� (this - mate)

multiply

public Vector3D multiply(double scale)
�^����ꂽ�X�P?[����?悶���x�N�g����Ԃ�?B

Parameters:
scale - �X�P?[��
Returns:
(this * scale)

divide

public Vector3D divide(double scale)
�^����ꂽ�X�P?[���Ŋ��B��x�N�g����Ԃ�?B

Parameters:
scale - �X�P?[��
Returns:
(this / scale)

identical

public boolean identical(Vector3D mate)
��x�N�g���̓���?��𔻒肷��?B

��‚̃x�N�g����?��̑傫����?A ��?�?ݒ肳��Ă��鉉�Z?�?��?u�����̋��e��?�?v���?��������?A ��‚̃x�N�g���͓���ł����̂Ɣ��f����?B

Parameters:
mate - ����̑�?ۂƂȂ�x�N�g��
Returns:
��‚̃x�N�g��������̃x�N�g���ł���Ƃ݂Ȃ���� true?A����Ȃ��� false
See Also:
ConditionOfOperation, identicalDirection(Vector3D)

identicalDirection

public boolean identicalDirection(Vector3D mate)
��x�N�g���̓�����?��𔻒肷��?B

��‚̃x�N�g���̂Ȃ��p�x��?A ��?�?ݒ肳��Ă��鉉�Z?�?��?u�p�x�̋��e��?�?v���?��������?A ��‚̃x�N�g���͓�����ł����̂Ɣ��f����?B

�Ȃ�?A���]?�Ԃ͓���Ƃ݂Ȃ��Ȃ�?B

Parameters:
mate - ����̑�?ۂƂȂ�x�N�g��
Returns:
��‚̃x�N�g����������̃x�N�g���Ƃ݂Ȃ���� true?A����Ȃ��� false
See Also:
ConditionOfOperation, identical(Vector3D), parallelDirection(Vector3D)

parallelDirection

public boolean parallelDirection(Vector3D mate)
��x�N�g���̓�����?��𔻒肷��?B

��‚̃x�N�g���̂Ȃ��p�x��?A ��?�?ݒ肳��Ă��鉉�Z?�?��?u�p�x�̋��e��?�?v���?��������?A ��‚̃x�N�g���͓�����ł����̂Ɣ��f����?B

�Ȃ�?A���]?�Ԃӯ��Ƃ݂Ȃ�?B

Parameters:
mate - ����̑�?ۂƂȂ�x�N�g��
Returns:
��‚̃x�N�g����������̃x�N�g���Ƃ݂Ȃ���� true?A����Ȃ��� false
See Also:
ConditionOfOperation, identicalDirection(Vector3D)

norm

public double norm()
�x�N�g���̃m������Ԃ�?B

Specified by:
norm in class AbstractVector
Returns:
�x�N�g���̃m���� (x^2) + (y^2) + (z^2)

project

public Vector3D project(Vector3D dNorm)
�x�N�g���𕽖ʂɓ��e����?B

Parameters:
dNorm - ���ʂ̖@?�x�N�g��
Returns:
����?�ɓ��e���ꂽ�x�N�g��

toPoint3D

public Point3D toPoint3D()
�R�����̓_ (Point3D) �ɕϊ�����?B

Returns:
���_����̈ʒu�x�N�g���Ƃ݂Ȃ����_

toPoint3D

public static Point3D[] toPoint3D(Vector3D[] vecs)
�x�N�g���̔z���R�����̓_ (Point3D) �̔z��ɕϊ�����?B

Returns:
���_����̈ʒu�x�N�g���Ƃ݂Ȃ����_�̔z��

toDoubleArray

public double[] toDoubleArray()
double�̔z��ɕϊ�����?B

Returns:
?W�l����double�̔z��

orthogonal

public Vector3D orthogonal()
Get a vector orthogonal to the instance.

There are an infinite number of normalized vectors orthogonal to the instance. This method picks up one of them almost arbitrarily. It is useful when one needs to compute a reference frame with one of the axes in a predefined direction. The following example shows hos to build a frame having the k axis aligned with the known vector u :


   LiteralVector3D k = u;
   k.unitized();
   Vector3D i = k.orthogonal();
   Vector3D j = k.crossProduct(i);
 

Returns:
a new normalized vector orthogonal to the instance
Throws:
java.lang.ArithmeticException - if the norm of the instance is null

angleWith

public double angleWith(Vector3D mate,
                        Vector3D norm)
���̃x�N�g���Ƃ̊p�x (���W�A��) ��?�߂�?B

this ���� mate �ւ�?����̊p�x (0 ?` 2pi)
�����ł�?����Ƃ�?Anorm ����BĂ�����猩���Ƃ���?����

Parameters:
mate - ����̃x�N�g��
norm - ?u?����?v�숂߂��?��ƂȂ�x�N�g��
Returns:
����̃x�N�g���Ƃ̊p�x

doTransformBy

protected abstract Vector3D doTransformBy(boolean reverseTransform,
                                          CartesianTransformationOperator3D transformationOperator,
                                          java.util.Hashtable transformedGeometries)
���̃x�N�g����?A�^����ꂽ�􉽓I�ϊ����Z�q�ŕϊ�����?B

transformedGeometries ��?A �ϊ��O�̊􉽗v�f��L?[�Ƃ�?A �ϊ���̊􉽗v�f��l�Ƃ���n�b�V���e?[�u���ł���?B

this �� transformedGeometries ��ɃL?[�Ƃ��đ�?݂��Ȃ�?�?��ɂ�?A this �� transformationOperator �ŕϊ�������̂�Ԃ�?B ����?ۂɃ?�\�b�h�Ք�ł� this ��L?[?A �ϊ����ʂ�l�Ƃ��� transformedGeometries �ɒljB���?B

this �� transformedGeometries ��Ɋ�ɃL?[�Ƃ��đ�?݂���?�?��ɂ�?A ��?ۂ̕ϊ���?s�Ȃ킸?A���̃L?[�ɑΉ�����l��Ԃ�?B ����?��?��?ċA�I��?s�Ȃ���?B

transformedGeometries �� null �ł�?\��Ȃ�?B transformedGeometries �� null ��?�?��ɂ�?A ?�� this �� transformationOperator �ŕϊ�������̂�Ԃ�?B

Parameters:
reverseTransform - �t�ϊ�����̂ł���� true?A�����łȂ���� false
transformationOperator - �􉽓I�ϊ����Z�q
transformedGeometries - ��ɓ��l�̕ϊ���{�����􉽗v�f��܂ރn�b�V���e?[�u��
Returns:
�ϊ���̊􉽗v�f

transformBy

public Vector3D transformBy(boolean reverseTransform,
                            CartesianTransformationOperator3D transformationOperator,
                            java.util.Hashtable transformedGeometries)
���̃x�N�g����?A�^����ꂽ�􉽓I�ϊ����Z�q�ŕϊ�����?B

transformedGeometries ��?A �ϊ��O�̊􉽗v�f��L?[�Ƃ�?A �ϊ���̊􉽗v�f��l�Ƃ���n�b�V���e?[�u���ł���?B

this �� transformedGeometries ��ɃL?[�Ƃ��đ�?݂��Ȃ�?�?��ɂ�?A this �� transformationOperator �ŕϊ�������̂�Ԃ�?B ����?ۂɃ?�\�b�h�Ք�ł� this ��L?[?A �ϊ����ʂ�l�Ƃ��� transformedGeometries �ɒljB���?B

this �� transformedGeometries ��Ɋ�ɃL?[�Ƃ��đ�?݂���?�?��ɂ�?A ��?ۂ̕ϊ���?s�Ȃ킸?A���̃L?[�ɑΉ�����l��Ԃ�?B ����?��?��?ċA�I��?s�Ȃ���?B

transformedGeometries �� null �ł�?\��Ȃ�?B transformedGeometries �� null ��?�?��ɂ�?A ?�� this �� transformationOperator �ŕϊ�������̂�Ԃ�?B

Parameters:
reverseTransform - �t�ϊ�����̂ł���� true?A�����łȂ���� false
transformationOperator - �􉽓I�ϊ����Z�q
transformedGeometries - ��ɓ��l�̕ϊ���{�����􉽗v�f��܂ރn�b�V���e?[�u��
Returns:
�ϊ���̊􉽗v�f

transformBy

public Vector3D transformBy(CartesianTransformationOperator3D transformationOperator,
                            java.util.Hashtable transformedGeometries)
���̃x�N�g����?A�^����ꂽ�􉽓I�ϊ����Z�q�ŕϊ�����?B

transformedGeometries ��?A �ϊ��O�̊􉽗v�f��L?[�Ƃ�?A �ϊ���̊􉽗v�f��l�Ƃ���n�b�V���e?[�u���ł���?B

this �� transformedGeometries ��ɃL?[�Ƃ��đ�?݂��Ȃ�?�?��ɂ�?A this �� transformationOperator �ŕϊ�������̂�Ԃ�?B ����?ۂɃ?�\�b�h�Ք�ł� this ��L?[?A �ϊ����ʂ�l�Ƃ��� transformedGeometries �ɒljB���?B

this �� transformedGeometries ��Ɋ�ɃL?[�Ƃ��đ�?݂���?�?��ɂ�?A ��?ۂ̕ϊ���?s�Ȃ킸?A���̃L?[�ɑΉ�����l��Ԃ�?B ����?��?��?ċA�I��?s�Ȃ���?B

transformedGeometries �� null �ł�?\��Ȃ�?B transformedGeometries �� null ��?�?��ɂ�?A ?�� this �� transformationOperator �ŕϊ�������̂�Ԃ�?B

Parameters:
transformationOperator - �􉽓I�ϊ����Z�q
transformedGeometries - ��ɓ��l�̕ϊ���{�����􉽗v�f��܂ރn�b�V���e?[�u��
Returns:
�ϊ���̊􉽗v�f

reverseTransformBy

public Vector3D reverseTransformBy(CartesianTransformationOperator3D transformationOperator,
                                   java.util.Hashtable transformedGeometries)
���̃x�N�g����?A�^����ꂽ�􉽓I�ϊ����Z�q�ŋt�ϊ�����?B

transformedGeometries ��?A �ϊ��O�̊􉽗v�f��L?[�Ƃ�?A �ϊ���̊􉽗v�f��l�Ƃ���n�b�V���e?[�u���ł���?B

this �� transformedGeometries ��ɃL?[�Ƃ��đ�?݂��Ȃ�?�?��ɂ�?A this �� transformationOperator �ŋt�ϊ�������̂�Ԃ�?B ����?ۂɃ?�\�b�h�Ք�ł� this ��L?[?A �ϊ����ʂ�l�Ƃ��� transformedGeometries �ɒljB���?B

this �� transformedGeometries ��Ɋ�ɃL?[�Ƃ��đ�?݂���?�?��ɂ�?A ��?ۂ̕ϊ���?s�Ȃ킸?A���̃L?[�ɑΉ�����l��Ԃ�?B ����?��?��?ċA�I��?s�Ȃ���?B

transformedGeometries �� null �ł�?\��Ȃ�?B transformedGeometries �� null ��?�?��ɂ�?A ?�� this �� transformationOperator �ŋt�ϊ�������̂�Ԃ�?B

Parameters:
transformationOperator - �􉽓I�ϊ����Z�q
transformedGeometries - ��ɓ��l�̕ϊ���{�����􉽗v�f��܂ރn�b�V���e?[�u��
Returns:
�t�ϊ���̊􉽗v�f

of

public static LiteralVector3D of(double x,
                                 double y,
                                 double z)
LiteralVector3D �̃C���X�^���X��?�?�����?B

Parameters:
x - X ?���
y - Y ?���
z - Z ?���
Returns:
LiteralVector3D �̃C���X�^���X

of

public static LiteralVector3D of(double[] components)
LiteralVector3D �̃C���X�^���X��?�?�����?B

Parameters:
components - X, Y?����̔z�� (�v�f?� 3)
Returns:
LiteralVector3D �̃C���X�^���X