CubeTwister 2.0alpha142 2012-02-11

ch.randelshofer.rubik
Class AbstractRubiksCubeIdx3D

java.lang.Object
  extended by ch.randelshofer.rubik.AbstractCube3D
      extended by ch.randelshofer.rubik.AbstractCubeIdx3D
          extended by ch.randelshofer.rubik.AbstractRubiksCubeIdx3D
All Implemented Interfaces:
Cube3D, CubeListener, java.beans.PropertyChangeListener, java.util.EventListener, javax.swing.event.ChangeListener
Direct Known Subclasses:
RubiksBarrelIdx3D, RubiksCubeIdx3D, RubiksCuboctahedronIdx3D, RubiksDiamondIdx3D

public abstract class AbstractRubiksCubeIdx3D
extends AbstractCubeIdx3D

Abstract base class for the geometrical representation of a RubiksCube using the Idx3D engine. Each part is represented by a idx3d_Object. The idx3d_Object is a child of an idx3d_Group which represents the explosion factor. The idx3d_Group is a child of the idx3d_Scene.

Version:
3.0 2007-12-30 Adapted to changes in AbstractCube.
2.2 2007-09-09 Use SplineInterpolator for cube twists.
2.1 2006-02-21 Avoid unecessary object creation.
2.0 2004-08-29 Reflectivity of part fill color increased from 160 to 300. We use now a hierarchical scene graph. Support for explosion addded.
1.0 December 26, 2003 Created.
Author:
Werner Randelshofer

Nested Class Summary
 
Nested classes/interfaces inherited from class ch.randelshofer.rubik.AbstractCube3D
AbstractCube3D.PartAction, AbstractCube3D.SwipeAction
 
Field Summary
protected static float PART_LENGTH
          A cube part has a side length of 18 mm.
 
Fields inherited from class ch.randelshofer.rubik.AbstractCubeIdx3D
alphaBetaTransform, cachedStickersImage, centerCount, centerOffset, cornerCount, cornerOffset, edgeCount, edgeOffset, explosion, explosionShift, explosionTransforms, HALF_PI, identityNormalMatrix, identityVertexMatrix, isInStartedPlayer, locationTransforms, partCount, parts, PI, scaleTransform, scene, sharedLightmap, sideCount, sideOffset, stickersTexture
 
Fields inherited from class ch.randelshofer.rubik.AbstractCube3D
attributes, changeEvent, dispatcher, isAnimated, layerCount, listenerList
 
Constructor Summary
AbstractRubiksCubeIdx3D()
          Creates a new instance.
 
Method Summary
 void cubeTwisted(CubeEvent evt)
           
protected abstract  int getPartFaceIndexForStickerIndex(int stickerIndex)
           
abstract  int getPartIndexForStickerIndex(int stickerIndex)
           
protected abstract  int getStickerCount()
           
protected abstract  int getStickerIndexForPart(int part, int orientation)
           
protected  float getUnitScaleFactor()
           
protected  void init()
           
protected  void initCenter()
           
protected abstract  void initCorners()
           
protected abstract  void initEdges()
           
protected abstract  void initSides()
           
protected  void initTransforms()
           
 void validateTwist(int[] partIndices, int[] locations, int[] orientations, int length, int axis, int angle, float alpha)
           
 
Methods inherited from class ch.randelshofer.rubik.AbstractCubeIdx3D
dispose, getLock, getPart, getPartCount, getScene, initActions, isInStartedPlayer, setInStartedPlayer, setStickerBeveling, updateAlphaBeta, updateAttributes, updateCube, updateExplosionFactor, updateExplosionFactor, updatePartFillColor, updatePartOutlineColor, updatePartsFillColor, updatePartsVisibility, updatePartVisibility, updateScaleFactor, updateScaleFactor, updateStickerFillColor, updateStickersFillColor, updateStickersImage, updateStickerVisibility, validateAlphaBeta, validateAttributes, validateCube, validateScaleFactor, validateStickersImage
 
Methods inherited from class ch.randelshofer.rubik.AbstractCube3D
addChangeListener, addCube3DListener, createAttributes, cubeChanged, dispatch, fireActionPerformed, fireMouseEntered, fireMouseExited, fireMousePressed, fireMouseReleased, fireStateChanged, getAnimator, getAttributes, getCube, getDispatcher, isAdjusting, isAnimated, isAnimating, isShowGhostParts, propertyChange, removeChangeListener, removeCube3DListener, setAnimated, setAnimator, setAttributes, setCube, setDispatcher, setLock, setShowGhostParts, stateChanged, stopAnimation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ch.randelshofer.rubik.Cube3D
getKind
 

Field Detail

PART_LENGTH

protected static final float PART_LENGTH
A cube part has a side length of 18 mm.

See Also:
Constant Field Values
Constructor Detail

AbstractRubiksCubeIdx3D

public AbstractRubiksCubeIdx3D()
Creates a new instance.

Method Detail

init

protected void init()

getUnitScaleFactor

protected float getUnitScaleFactor()
Overrides:
getUnitScaleFactor in class AbstractCubeIdx3D

getPartIndexForStickerIndex

public abstract int getPartIndexForStickerIndex(int stickerIndex)
Specified by:
getPartIndexForStickerIndex in interface Cube3D
Specified by:
getPartIndexForStickerIndex in class AbstractCube3D

getPartFaceIndexForStickerIndex

protected abstract int getPartFaceIndexForStickerIndex(int stickerIndex)
Specified by:
getPartFaceIndexForStickerIndex in class AbstractCube3D

getStickerIndexForPart

protected abstract int getStickerIndexForPart(int part,
                                              int orientation)

getStickerCount

protected abstract int getStickerCount()
Specified by:
getStickerCount in class AbstractCube3D

initEdges

protected abstract void initEdges()

initCorners

protected abstract void initCorners()

initSides

protected abstract void initSides()

initCenter

protected void initCenter()

initTransforms

protected void initTransforms()

cubeTwisted

public void cubeTwisted(CubeEvent evt)
Specified by:
cubeTwisted in interface CubeListener
Overrides:
cubeTwisted in class AbstractCube3D

validateTwist

public void validateTwist(int[] partIndices,
                          int[] locations,
                          int[] orientations,
                          int length,
                          int axis,
                          int angle,
                          float alpha)
Specified by:
validateTwist in class AbstractCubeIdx3D

(c) Werner Randelshofer.
All rights reserved.