org.jeometry.factory.TransformBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jeometry-api Show documentation
Show all versions of jeometry-api Show documentation
Jeometry, a Mathematic and Geometry library for Java
package org.jeometry.factory;
import org.jeometry.Jeometry;
import org.jeometry.geom3D.transform.Transform3D;
import org.jeometry.geom3D.transform.Transform3DMatrix;
import org.jeometry.geom3D.transform.Transform3DQuaternion;
import org.jeometry.math.Matrix;
import org.jeometry.math.Vector;
/**
* An interface that describes a transform builder.
* A transform builder enables to create implementations of interfaces described within the transform
packages ({@link Transform3D}, ...).
* @author Julien Seinturier - COMEX S.A. - [email protected] - https://github.com/jorigin/jeometry
* @version {@value Jeometry#version}
* @since 1.0.2
*/
public interface TransformBuilder {
/**
* Create a new {@link Transform3DMatrix} that represents the identity transform.
* @return a new {@link Transform3DMatrix} that represents the identity transform
*/
public Transform3DMatrix createTransform3DMatrix();
/**
* Create a new {@link Transform3DMatrix} that relies on the 4x4 given matrix.
* The 4x4 matrix represents a 3D affine transform defined such that:
* $$
* M = \begin{bmatrix}
* s_{x}r_{00} & s_{x}r_{01} & s_{x}r_{02} & t_{x} \\
* s_{y}r_{10} & s_{y}r_{11} & s_{y}r_{12} & t_{y} \\
* s_{z}r_{20} & s_{z}r_{21} & s_{z}r_{22} & t_{z} \\
* 0 & 0 & 0 & 1
* \end{bmatrix}
* $$
* where:
*
* - rii form the 3x3 rotation matrix
*
- tk form the translation vector
*
- sx, sy, sz are the scales values along axis
*
* @param matrix the 4x4 matrix that represents a 3D affine transform
* @return a new {@link Transform3DMatrix}
* @throws IllegalArgumentException if the input matrix is null
or is not 4x4 sized
*/
public Transform3DMatrix createTransform3DMatrix(Matrix matrix);
/**
* Create a new {@link Transform3DMatrix} that relies on the given parameters.
* The 4x4 underlying matrix is defined such that:
* $$
* M = \begin{bmatrix}
* sr_{00} & sr_{01} & sr_{02} & t_{x} \\
* sr_{10} & sr_{11} & sr_{12} & t_{y} \\
* sr_{20} & sr_{21} & sr_{22} & t_{z} \\
* 0 & 0 & 0 & 1
* \end{bmatrix}
* $$
* where:
*
* - rii form the 3x3 rotation matrix
*
- tk form the translation vector
*
- s is the scale value
*
* @param rotation the rotation
* @param translation the translation as a 3 dimensioned vector
* @param scale the scale factor (applied to all axis)
* @return a new {@link Transform3DMatrix}
* @throws IllegalArgumentException if the rotation matrix is not 3x3 sized, if the translation Vector is not 3 dimensioned
*/
public Transform3DMatrix createTransform3DMatrix(Matrix rotation, Vector translation, double scale);
/**
* Create a new {@link Transform3DMatrix} that relies on the 4x4 given matrix.
* The 4x4 matrix represents a 3D affine transform defined such that:
* $$
* M = \begin{bmatrix}
* s_{x}r_{00} & s_{x}r_{01} & s_{x}r_{02} & t_{x} \\
* s_{y}r_{10} & s_{y}r_{11} & s_{y}r_{12} & t_{y} \\
* s_{z}r_{20} & s_{z}r_{21} & s_{z}r_{22} & t_{z} \\
* 0 & 0 & 0 & 1
* \end{bmatrix}
* $$
* where:
*
* - rii form the 3x3 rotation matrix
*
- tk form the translation vector
*
- sx, sy, sz are the scales values along axis
*
* @param matrix the 4x4 matrix that represents a 3D affine transform
* @return a new {@link Transform3DMatrix}
* @throws IllegalArgumentException if the input matrix is null
or is not 4x4 sized
*/
public Transform3DMatrix createTransform3DMatrix(double[][] matrix);
/**
* Create a new {@link Transform3DQuaternion} that represents the identity transform.
* @return a new {@link Transform3DQuaternion} that represents the identity transform
*/
public Transform3DQuaternion createTransform3DQuaternion();
}