@Override public RigidModel2D copy() { final RigidModel2D m = new RigidModel2D(); m.cos = cos; m.sin = sin; m.tx = tx; m.ty = ty; m.itx = itx; m.ity = ity; m.cost = cost; return m; }
/** * Initialize the model such that the respective affine transform is: * * cos(θ) -sin(θ) tx * sin(θ) cos(θ) ty * 0 0 1 * * @param theta θ * @param tx * @param ty */ final public void set( final double theta, final double tx, final double ty ) { set( Math.cos( theta ), Math.sin( theta ), tx, ty ); }
@Override final public double[] applyInverse( final double[] l ) { assert l.length >= 2 : "2d rigid transformations can be applied to 2d points only."; final double[] transformed = l.clone(); applyInverseInPlace( transformed ); return transformed; }
final RigidModel2D m = new RigidModel2D(); try m.fit( s ); m.applyInPlace( l ); svg += "M " + l[ 0 ] + " " + l[ 1 ] + " "; m.applyInPlace( l ); svg += "L " + l[ 0 ] + " " + l[ 1 ] + " "; m.applyInPlace( l ); svg += "L " + l[ 0 ] + " " + l[ 1 ] + " "; m.applyInPlace( l ); svg += "L " + l[ 0 ] + " " + l[ 1 ] + " ";
break; case 1: tiles.add( new Tile< RigidModel2D >( new RigidModel2D() ) ); break; case 2: final RigidModel2D rigid = new RigidModel2D(); rigid.fit( firstMeshVertices ); rigid.applyInverseInPlace( w );
break; case 1: params.model = new RigidModel2D(); break; case 2: break; default: params.model = new RigidModel2D(); break; break; case 1: params.model = new InterpolatedAffineModel2D( params.model, new RigidModel2D(), (float)params.lambda ); break; case 2: return null; default: params.model = new InterpolatedAffineModel2D( params.model, new RigidModel2D(), (float)params.lambda ); break; final RigidModel2D model = new RigidModel2D(); model.set( (float)Math.toRadians( defaultDegrees1 ), 0, 0 ); params.initialModel = model;
@Override final public double[] apply( final double[] l ) { assert l.length >= 2 : "2d rigid transformations can be applied to 2d points only."; final double[] transformed = l.clone(); applyInPlace( transformed ); return transformed; }
case 1: final RigidModel2D r = ( RigidModel2D )( Object )pair[ 1 ].getModel().createInverse(); r.concatenate( ( RigidModel2D )( Object )pair[ 0 ].getModel() ); m = r; break;
break; case 1: tiles.add( new Tile< RigidModel2D >( new RigidModel2D() ) ); break; case 2: final RigidModel2D rigid = new RigidModel2D(); rigid.fit( firstMeshVertices ); rigid.applyInverseInPlace( w );
final RigidModel2D m = new RigidModel2D(); try m.fit( s ); m.applyInPlace( l ); svg += "M " + l[ 0 ] + " " + l[ 1 ] + " "; m.applyInPlace( l ); svg += "L " + l[ 0 ] + " " + l[ 1 ] + " "; m.applyInPlace( l ); svg += "L " + l[ 0 ] + " " + l[ 1 ] + " "; m.applyInPlace( l ); svg += "L " + l[ 0 ] + " " + l[ 1 ] + " ";
@Override final public double[] apply( final double[] l ) { assert l.length >= 2 : "2d rigid transformations can be applied to 2d points only."; final double[] transformed = l.clone(); applyInPlace( transformed ); return transformed; }
public RigidTile2D( final Patch patch ) { this( new RigidModel2D(), patch ); }
/** * Initialize the model such that the respective affine transform is: * * cos(θ) -sin(θ) tx * sin(θ) cos(θ) ty * 0 0 1 * * @param theta θ * @param tx * @param ty */ final public void set( final double theta, final double tx, final double ty ) { set( Math.cos( theta ), Math.sin( theta ), tx, ty ); }
@Override final public double[] applyInverse( final double[] l ) { assert l.length >= 2 : "2d rigid transformations can be applied to 2d points only."; final double[] transformed = l.clone(); applyInverseInPlace( transformed ); return transformed; }
@Override public RigidModel2D copy() { final RigidModel2D m = new RigidModel2D(); m.cos = cos; m.sin = sin; m.tx = tx; m.ty = ty; m.itx = itx; m.ity = ity; m.cost = cost; return m; }
/** * Initialize the model with the parameters of the {@link AffineTransform} * of the {@link Patch}. The {@link AffineTransform} should be a * Rigid Transformation, otherwise the results will not be what you might * expect. This means, that: * <ul> * <li>{@link AffineTransform#getScaleX()} == {@link AffineTransform#getScaleY()}</li> * <li>{@link AffineTransform#getShearX()} == -{@link AffineTransform#getShearY()}</li> * <li>{@link AffineTransform#getScaleX()}<sup>2</sup> + {@link AffineTransform#getShearX()}<sup>2</sup> == 1</li> * </ul> */ @Override protected void initModel() { final AffineTransform a = patch.getAffineTransform(); model.set( ( float )a.getScaleX(), ( float )a.getShearY(), ( float )a.getTranslateX(), ( float )a.getTranslateY() ); }
/** * TODO Not yet tested */ @Override public RigidModel2D createInverse() { final RigidModel2D ict = new RigidModel2D(); ict.cos = cos; ict.sin = -sin; ict.tx = itx; ict.ty = ity; ict.itx = tx; ict.ity = ty; ict.cost = cost; return ict; }
@SuppressWarnings( "rawtypes" ) @Override protected void initModel() { final AffineTransform a = patch.getAffineTransform(); if ( AffineModel2D.class.isInstance( model ) ) ( ( AffineModel2D )( Object )model ).set( a ); else if ( SimilarityModel2D.class.isInstance( model ) ) ( ( SimilarityModel2D )( Object )model ).set( a.getScaleX(), a.getShearY(), a.getTranslateX(), a.getTranslateY() ); else if ( RigidModel2D.class.isInstance( model ) ) ( ( RigidModel2D )( Object )model ).set( a.getScaleX(), a.getShearY(), a.getTranslateX(), a.getTranslateY() ); else if ( TranslationModel2D.class.isInstance( model ) ) ( ( TranslationModel2D )( Object )model ).set( a.getTranslateX(), a.getTranslateY() ); else if ( InterpolatedAffineModel2D.class.isInstance( model ) ) ( ( InterpolatedAffineModel2D )( Object )model ).set( a ); }
/** * TODO Not yet tested */ @Override public RigidModel2D createInverse() { final RigidModel2D ict = new RigidModel2D(); ict.cos = cos; ict.sin = -sin; ict.tx = itx; ict.ty = ity; ict.itx = tx; ict.ity = ty; ict.cost = cost; return ict; }
else if ( fields[ 0 ].equals( "rigid" ) ) model = new RigidModel2D(); else if ( fields[ 0 ].equals( "similarity" ) ) model = new SimilarityModel2D(); else if ( fields[ 0 ].equals( "affine" ) ) model = new AffineModel2D();