本文整理汇总了Java中javax.vecmath.Matrix4d.setIdentity方法的典型用法代码示例。如果您正苦于以下问题:Java Matrix4d.setIdentity方法的具体用法?Java Matrix4d.setIdentity怎么用?Java Matrix4d.setIdentity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.vecmath.Matrix4d
的用法示例。
在下文中一共展示了Matrix4d.setIdentity方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildProfile
import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
public static Prof buildProfile( Line3d oLine, Point3d cen ) {
Matrix4d to2D = new Matrix4d();
Vector3d c2 = oLine.dir(), c3 = new Vector3d();
c2.normalize();
c3.cross( c2, UP );
to2D.setIdentity();
to2D.setRow( 0, c3.x, c3.y, c3.z, 0 );
to2D.setRow( 1, UP.x, UP.y, UP.z, 0 );
to2D.setRow( 2, c2.x, c2.y, c2.z, 0 );
{
Point3d start = new Point3d( cen.x, 0, cen.z );
to2D.transform( start );
to2D.m03 = -start.x;
to2D.m13 = -start.y;
to2D.m23 = -start.z;
to2D.m33 = 1;
}
Prof monotonic = new Prof(to2D, c2);
return monotonic;
}
示例2: writeTo
import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
@Override
public void writeTo(VirtualInstanceCollection virtualInstanceCollection, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws UnsupportedEncodingException {
String charSet = "UTF-8";
JsonGenerator jg = Json.createGenerator(new OutputStreamWriter(entityStream, charSet));
jg.writeStartArray();
Matrix4d gM = new Matrix4d();
gM.setIdentity();
PartLink virtualRootPartLink = getVirtualRootPartLink(virtualInstanceCollection);
List<PartLink> path = new ArrayList<>();
path.add(virtualRootPartLink);
InstanceBodyWriterTools.generateInstanceStreamWithGlobalMatrix(productService, path, gM, virtualInstanceCollection, new ArrayList<>(), jg);
jg.writeEnd();
jg.flush();
}
示例3: combineTransformation
import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
static Matrix4d combineTransformation(Matrix4d matrix, Vector3d translation, Vector3d rotation) {
Matrix4d gM = new Matrix4d(matrix);
Matrix4d m = new Matrix4d();
m.setIdentity();
m.setTranslation(translation);
gM.mul(m);
m.setIdentity();
m.rotZ(rotation.z);
gM.mul(m);
m.setIdentity();
m.rotY(rotation.y);
gM.mul(m);
m.setIdentity();
m.rotX(rotation.x);
gM.mul(m);
return gM;
}
示例4: setDefaults
import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
protected void setDefaults( CPUAlgebraicSurfaceRenderer asr )
{
asr.getCamera().loadProperties( defaults, "camera_", "" );
Util.setOptimalCameraDistance( asr.getCamera() );
for( int i = 0; i < AlgebraicSurfaceRenderer.MAX_LIGHTS; i++ )
{
asr.getLightSource( i ).setStatus(LightSource.Status.OFF);
asr.getLightSource( i ).loadProperties( defaults, "light_", "_" + i );
}
asr.setBackgroundColor( BasicIO.fromColor3fString( defaults.getProperty( "background_color" ) ) );
// identity.setIdentity();
// asr.setTransform( BasicIO.fromMatrix4dString( defaults.getProperty( "rotation_matrix" ) ) );
Matrix4d scaleMatrix = new Matrix4d();
scaleMatrix.setIdentity();
scaleMatrix.setScale( 1.0 / Double.parseDouble( defaults.getProperty( "scale_factor" ) ) );
asr.setSurfaceTransform( scaleMatrix );
asr.setAntiAliasingMode( AntiAliasingMode.ADAPTIVE_SUPERSAMPLING );
asr.setAntiAliasingPattern( AntiAliasingPattern.RG_2x2 );
}
示例5: getRepeatTransform
import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
/**
* Return the transformation that needs to be applied to a
* repeat in order to superimpose onto repeat 0.
*
* @param repeat the repeat index
* @return transformation matrix for the repeat
*/
public Matrix4d getRepeatTransform(int repeat){
Matrix4d transform = new Matrix4d();
transform.setIdentity();
int[] counts = getAxisCounts(repeat);
for(int t = counts.length-1; t>=0; t--) {
if( counts[t] == 0 )
continue;
Matrix4d axis = new Matrix4d(axes.get(t).getOperator());
for(int i=0;i<counts[t];i++) {
transform.mul(axis);
}
}
return transform;
}
示例6: setC1
import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
public void setC1(int n) {
Rotation r = new Rotation();
List<Integer> permutation = new ArrayList<Integer>(n);
for (int i = 0; i < n; i++) {
permutation.add(i);
}
r.setPermutation(permutation);
Matrix4d m = new Matrix4d();
m.setIdentity();
r.setTransformation(m);
r.setAxisAngle(new AxisAngle4d());
r.setFold(1);
r.setScores(new QuatSymmetryScores());
rotations.add(r);
pointGroup = "C1";
}
示例7: getMatrixFromAlgebraic
import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
public static Matrix4d getMatrixFromAlgebraic(String transfAlgebraic) {
String[] parts = transfAlgebraic.toUpperCase().split(",");
double[] xCoef = convertAlgebraicStrToCoefficients(parts[0].trim());
double[] yCoef = convertAlgebraicStrToCoefficients(parts[1].trim());
double[] zCoef = convertAlgebraicStrToCoefficients(parts[2].trim());
Matrix4d mat = new Matrix4d();
mat.setIdentity();
mat.setRotation(new Matrix3d(xCoef[0],xCoef[1],xCoef[2],yCoef[0],yCoef[1],yCoef[2],zCoef[0],zCoef[1],zCoef[2]));
mat.setTranslation(new Vector3d(xCoef[3],yCoef[3],zCoef[3]));
return mat;
//return new Matrix4d(xCoef[0],xCoef[1],xCoef[2],xCoef[3],
// yCoef[0],yCoef[1],yCoef[2],yCoef[3],
// zCoef[0],zCoef[1],zCoef[2],zCoef[3],
// 0,0,0,1);
}
示例8: testVecmathTransformation
import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
@Test
public void testVecmathTransformation() {
Atom atom = getAtom(1.0, 1.0, 1.0);
//Identity transform
Matrix4d ident = new Matrix4d();
ident.setIdentity();
Calc.transform(atom, ident);
Point3d expected = new Point3d(1.0, 1.0, 1.0);
Point3d actual = atom.getCoordsAsPoint3d();
assertEquals(expected, actual);
//Sample transform
Matrix4d sample = getSampleTransform();
Calc.transform(atom, sample);
expected = new Point3d(2.0, 7.0, -1.3);
actual = atom.getCoordsAsPoint3d();
assertEquals(expected, actual);
}
示例9: Prof
import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
public Prof() {
Matrix4d i = new Matrix4d();
i.setIdentity();
this.toFlat = this.to3d = i;
this.dir = new Vector3d(1,0,0);
}
示例10: writeTo
import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
@Override
public void writeTo(InstanceCollection instanceCollection, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws UnsupportedEncodingException {
String charSet = "UTF-8";
JsonGenerator jg = Json.createGenerator(new OutputStreamWriter(entityStream, charSet));
jg.writeStartArray();
Matrix4d gM = new Matrix4d();
gM.setIdentity();
InstanceBodyWriterTools.generateInstanceStreamWithGlobalMatrix(productService, null, gM, instanceCollection, new ArrayList<>(), jg);
jg.writeEnd();
jg.flush();
}
示例11: Matrix
import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
public Matrix(int poolSize) {
Preconditions.checkArgument(poolSize >= 0, "poolSize must be greater or equal to zero");
this.matrixPool = new Pool<>(Matrix4d::new, poolSize);
this.vectorPool = new Pool<>(Vector3d::new, poolSize);
this.axisAnglePool = new Pool<>(AxisAngle4d::new, poolSize);
this.matrixStack = new Stack<>();
Matrix4d mat = new Matrix4d();
mat.setIdentity();
this.matrixStack.push(mat);
}
示例12: translate
import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
public void translate(double x, double y, double z) {
Matrix4d mat = this.matrixStack.peek();
Matrix4d translation = this.getMatrix();
translation.setIdentity();
Vector3d vector = this.getVector(x, y, z);
translation.setTranslation(vector);
this.freeVector(vector);
mat.mul(translation);
this.freeMatrix(translation);
}
示例13: rotate
import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
public void rotate(double angle, double x, double y, double z) {
Matrix4d mat = this.matrixStack.peek();
Matrix4d rotation = this.getMatrix();
rotation.setIdentity();
AxisAngle4d axisAngle = this.getAxisAngle(x, y, z, angle);
rotation.setRotation(axisAngle);
this.freeAxisAngle(axisAngle);
mat.mul(rotation);
this.freeMatrix(rotation);
}
示例14: loadJSurfFromProperties
import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
public static void loadJSurfFromProperties( AlgebraicSurfaceRenderer asr, Properties props )
throws Exception
{
asr.setSurfaceFamily( props.getProperty( "surface_equation" ) );
Set< Map.Entry< Object, Object > > entries = props.entrySet();
String parameter_prefix = "surface_parameter_";
for( Map.Entry< Object, Object > entry : entries )
{
String name = (String) entry.getKey();
if( name.startsWith( parameter_prefix ) )
{
String parameterName = name.substring( parameter_prefix.length() );
asr.setParameterValue( parameterName, Float.parseFloat( ( String ) entry.getValue() ) );
//System.out.println("LoadRenderPar: " + parameterName + "=" + entry.getValue() + " (" + Float.parseFloat( (String) entry.getValue()) + ") "+ asr.getParameterValue( parameterName));
}
}
asr.getCamera().loadProperties( props, "camera_", "" );
asr.getFrontMaterial().loadProperties(props, "front_material_", "");
asr.getBackMaterial().loadProperties(props, "back_material_", "");
for( int i = 0; i < AlgebraicSurfaceRenderer.MAX_LIGHTS; i++ )
{
asr.getLightSource( i ).setStatus(LightSource.Status.OFF);
asr.getLightSource( i ).loadProperties( props, "light_", "_" + i );
}
asr.setBackgroundColor( BasicIO.fromColor3fString( props.getProperty( "background_color" ) ) );
Matrix4d identity = new Matrix4d();
identity.setIdentity();
asr.setTransform( BasicIO.fromMatrix4dString( props.getProperty( "rotation_matrix" ) ) );
Matrix4d scaleMatrix = new Matrix4d();
scaleMatrix.setIdentity();
scaleMatrix.setScale( 1.0 / Double.parseDouble( props.getProperty( "scale_factor" ) ) );
asr.setSurfaceTransform( scaleMatrix );
}
示例15: calcTransformation
import javax.vecmath.Matrix4d; //导入方法依赖的package包/类
/**
* Superposition coords2 onto coords1 -- in other words, coords2 is rotated,
* coords1 is held fixed
*/
private void calcTransformation() {
// transformation.set(rotmat,new Vector3d(0,0,0), 1);
transformation.set(rotmat);
// long t2 = System.nanoTime();
// System.out.println("create transformation: " + (t2-t1));
// System.out.println("m3d -> m4d");
// System.out.println(transformation);
// combine with x -> origin translation
Matrix4d trans = new Matrix4d();
trans.setIdentity();
trans.setTranslation(new Vector3d(xtrans));
transformation.mul(transformation, trans);
// System.out.println("setting xtrans");
// System.out.println(transformation);
// combine with origin -> y translation
ytrans.negate();
Matrix4d transInverse = new Matrix4d();
transInverse.setIdentity();
transInverse.setTranslation(new Vector3d(ytrans));
transformation.mul(transInverse, transformation);
// System.out.println("setting ytrans");
// System.out.println(transformation);
}