List of usage examples for java.awt.geom AffineTransform setToIdentity
public void setToIdentity()
From source file:org.jcurl.core.base.ColliderBase.java
/** * Iterate over all rocks and call//from www.j a v a2 s.c om * {@link ColliderBase#computeWC(Rock, Rock, Rock, Rock, AffineTransform)} * for each pair. * <p> * Does not change <code>pos</code>! * </p> * <p> * Does not fire {@link SpeedSet#notifyChange()}! * </p> * * @see ColliderBase#computeWC(Rock, Rock, Rock, Rock, AffineTransform) * @param pos * @param speed * @param tr * <code>null</code> creates a new instance. * @return bitmask of the changed rocks */ public int compute(final PositionSet pos, final SpeedSet speed, AffineTransform tr) { if (log.isDebugEnabled()) log.debug("compute()"); int hits = 0; if (tr == null) tr = new AffineTransform(); else tr.setToIdentity(); for (int B = 0; B < RockSet.ROCKS_PER_SET; B++) for (int A = 0; A < B; A++) { if (log.isDebugEnabled()) log.debug("Compute hit " + A + "<->" + B); if (computeWC(pos.getRock(A), pos.getRock(B), speed.getRock(A), speed.getRock(B), tr)) { // mark the rocks' bits hit hits |= 1 << A; hits |= 1 << B; } } if (log.isDebugEnabled()) log.debug("hit rocks: " + Integer.toBinaryString(hits)); return hits; }
From source file:org.jcurl.core.impl.ColliderBase.java
/** * Iterate over all rocks and call//from w w w. java2s . co m * {@link ColliderBase#computeWC(Rock, Rock, Rock, Rock, AffineTransform)} * for each pair. * <p> * Does not change <code>pos</code>! * </p> * <p> * Does not fire {@link RockSet#fireStateChanged()}! * </p> * * @see ColliderBase#computeWC(Rock, Rock, Rock, Rock, AffineTransform) * @param pos * @param speed * @param tr * <code>null</code> creates a new instance. * @return bitmask of the changed rocks */ public int compute(final RockSet<Pos> pos, final RockSet<Vel> speed, AffineTransform tr) { if (log.isDebugEnabled()) log.debug("compute()"); int hits = 0; if (tr == null) tr = new AffineTransform(); else tr.setToIdentity(); // TUNE Parallel for (int B = 0; B < RockSet.ROCKS_PER_SET; B++) for (int A = 0; A < B; A++) { if (log.isDebugEnabled()) log.debug("Compute hit " + A + "<->" + B); if (computeWC(pos.getRock(A), pos.getRock(B), speed.getRock(A), speed.getRock(B), tr)) { // mark the rocks' bits hit hits |= 1 << A; hits |= 1 << B; } } if (log.isDebugEnabled()) log.debug("hit rocks: " + Integer.toBinaryString(hits)); return hits; }
From source file:org.jcurl.demo.tactics.sg.BroomPromptScenario.java
/** adjust position + rotation */ private static void syncBroomM2V(final Point2D b, final Affine scene) { if (b == null) return;//from www .j av a 2 s .c o m final AffineTransform t = scene.getAffine(); t.setToIdentity(); t.translate(b.getX(), b.getY()); MathVec.rotate(t, b.getX(), b.getY() - IceSize.FAR_HACK_2_TEE); MathVec.rotate(t, 0, 1); scene.setAffine(t); }
From source file:org.jcurl.demo.tactics.sg.BroomPromptScenario.java
private static void syncHandleM2V(final boolean outTurn, final Affine handle) { final AffineTransform t = handle.getAffine(); t.setToIdentity(); if (outTurn)/*from ww w .j a va 2s .co m*/ t.scale(-1, 1); handle.setAffine(t); }
From source file:org.jcurl.zui.piccolo.BroomPromptSimple.java
/** adjust position + rotation */ private void setBroom(final Point2D b) { if (b == null) return;// w ww . j a va 2 s. c o m final AffineTransform t = getTransformReference(true); t.setToIdentity(); t.translate(b.getX(), b.getY()); MathVec.rotate(t, b.getX(), b.getY() - IceSize.FAR_HACK_2_TEE); MathVec.rotate(t, 0, 1); invalidateFullBounds(); invalidatePaint(); }
From source file:spectrogram.Spectrogram.java
private void drawRotatedText(int tx, int ty, double theta, String text) { AffineTransform fontAT = new AffineTransform(); fontAT.setToIdentity(); fontAT.rotate(Math.toRadians(theta)); Font curFont = grph.getFont(); Font rotFont = curFont.deriveFont(fontAT); grph.setFont(rotFont);//from w w w . java 2 s.c om grph.drawString(text, tx, ty); grph.setFont(curFont); }
From source file:tufts.vue.LWComponent.java
protected final AffineTransform loadZeroTransform(final AffineTransform a) { if (parent == null) { a.setToIdentity(); return transformDownA(a); } else {/*from w w w . j av a2 s.c o m*/ return transformDownA(parent.loadZeroTransform(a)); } }