/** Sets this matrix to a concatenation of translation, rotation and scale. It is a more efficient form for: * <code>idt().translate(trn).rotate(degrees).scale(scale)</code> * @param trn The translation vector. * @param degrees The angle in degrees. * @param scale The scale vector. * @return This matrix for the purpose of chaining operations. */ public Affine2 setToTrnRotScl (Vector2 trn, float degrees, Vector2 scale) { return setToTrnRotScl(trn.x, trn.y, degrees, scale.x, scale.y); }
/** Sets this matrix to a concatenation of translation, rotation and scale. It is a more efficient form for: * <code>idt().translate(trn).rotate(degrees).scale(scale)</code> * @param trn The translation vector. * @param degrees The angle in degrees. * @param scale The scale vector. * @return This matrix for the purpose of chaining operations. */ public Affine2 setToTrnRotScl (Vector2 trn, float degrees, Vector2 scale) { return setToTrnRotScl(trn.x, trn.y, degrees, scale.x, scale.y); }
/** Returns the transform for this group's coordinate system. */ protected Matrix4 computeTransform () { Affine2 worldTransform = this.worldTransform; float originX = this.originX, originY = this.originY; worldTransform.setToTrnRotScl(x + originX, y + originY, rotation, scaleX, scaleY); if (originX != 0 || originY != 0) worldTransform.translate(-originX, -originY); // Find the first parent that transforms. Group parentGroup = parent; while (parentGroup != null) { if (parentGroup.transform) break; parentGroup = parentGroup.parent; } if (parentGroup != null) worldTransform.preMul(parentGroup.worldTransform); computedTransform.set(worldTransform); return computedTransform; }
/** Returns the transform for this group's coordinate system. */ protected Matrix4 computeTransform () { Affine2 worldTransform = this.worldTransform; float originX = this.originX, originY = this.originY; worldTransform.setToTrnRotScl(x + originX, y + originY, rotation, scaleX, scaleY); if (originX != 0 || originY != 0) worldTransform.translate(-originX, -originY); // Find the first parent that transforms. Group parentGroup = parent; while (parentGroup != null) { if (parentGroup.transform) break; parentGroup = parentGroup.parent; } if (parentGroup != null) worldTransform.preMul(parentGroup.worldTransform); computedTransform.set(worldTransform); return computedTransform; }
afn1.setToTrnRotScl(trn, rot, scl); afn2.setToTrnRotRadScl(trn, MathUtils.degreesToRadians * rot, scl); checkEqual(afn1, afn2); afn1.setToTrnRotScl(trn, 0, scl); afn2.setToTrnScl(trn, scl); checkEqual(afn1, afn2);
/** Sets this matrix to a concatenation of translation, rotation and scale. It is a more efficient form for: * <code>idt().translate(trn).rotate(degrees).scale(scale)</code> * @param trn The translation vector. * @param degrees The angle in degrees. * @param scale The scale vector. * @return This matrix for the purpose of chaining operations. */ public Affine2 setToTrnRotScl (Vector2 trn, float degrees, Vector2 scale) { return setToTrnRotScl(trn.x, trn.y, degrees, scale.x, scale.y); }
/** Sets this matrix to a concatenation of translation, rotation and scale. It is a more efficient form for: * <code>idt().translate(trn).rotate(degrees).scale(scale)</code> * @param trn The translation vector. * @param degrees The angle in degrees. * @param scale The scale vector. * @return This matrix for the purpose of chaining operations. */ public Affine2 setToTrnRotScl (Vector2 trn, float degrees, Vector2 scale) { return setToTrnRotScl(trn.x, trn.y, degrees, scale.x, scale.y); }
/** Returns the transform for this group's coordinate system. */ protected Matrix4 computeTransform () { Affine2 worldTransform = this.worldTransform; float originX = this.originX, originY = this.originY; worldTransform.setToTrnRotScl(x + originX, y + originY, rotation, scaleX, scaleY); if (originX != 0 || originY != 0) worldTransform.translate(-originX, -originY); // Find the first parent that transforms. Group parentGroup = parent; while (parentGroup != null) { if (parentGroup.transform) break; parentGroup = parentGroup.parent; } if (parentGroup != null) worldTransform.preMul(parentGroup.worldTransform); computedTransform.set(worldTransform); return computedTransform; }
protected Matrix4 computeTransform() { Affine2 worldTransform = this.worldTransform; Group root = getRoot(); worldTransform.setToTrnRotScl(root.getX(), root.getY(), 0, root.getScaleX(), root.getScaleY()); computedTransform.set(worldTransform); return computedTransform; } }