CubeTwister 2.0alpha141 2011-10-13

ch.randelshofer.rubik
Class AbstractCubeGeom3D

java.lang.Object
  extended by ch.randelshofer.rubik.AbstractCube3D
      extended by ch.randelshofer.rubik.AbstractCubeGeom3D
All Implemented Interfaces:
Cube3D, CubeListener, java.beans.PropertyChangeListener, java.util.EventListener, javax.swing.event.ChangeListener
Direct Known Subclasses:
AbstractCube6Geom3D, AbstractCube7Geom3D, AbstractPocketCubeGeom3D, AbstractProfessorCubeGeom3D, AbstractRevengeCubeGeom3D, AbstractRubiksCubeGeom3D

public abstract class AbstractCubeGeom3D
extends AbstractCube3D

Abstract base class for the geometrical representation of a Cube using the Geom3D engine.

Version:
7.1 2010-04-05 Added inStartedPlayer property.
6.1 2007-09-09 Animate twists using SplineInterpolator.
1.0 January 1, 2006 Created.
Author:
Werner Randelshofer

Nested Class Summary
 
Nested classes/interfaces inherited from class ch.randelshofer.rubik.AbstractCube3D
AbstractCube3D.PartAction, AbstractCube3D.SwipeAction
 
Field Summary
protected  int centerCount
           
protected  int centerOffset
           
protected  int cornerCount
           
protected  int cornerOffset
           
protected  int edgeCount
           
protected  int edgeOffset
           
protected static double HALF_PI
           
protected  Transform3D[] identityTransforms
           
protected  boolean isInStartedPlayer
           
protected  int mode
           
protected  int partCount
           
static int PARTS_MODE
           
protected  double PI
           
protected  Scene3D scene
           
protected  Shape3D[] shapes
           
protected  int sideCount
           
protected  int sideOffset
           
protected  TransformNode3D[] transforms
           
static int TWIST_MODE
           
 
Fields inherited from class ch.randelshofer.rubik.AbstractCube3D
attributes, changeEvent, dispatcher, isAnimated, layerCount, listenerList
 
Constructor Summary
AbstractCubeGeom3D(int layerCount, int cornerCount, int edgeCount, int sideCount, int centerCount)
          Creates a new instance.
 
Method Summary
protected abstract  void computeTransformation()
           
protected abstract  Cube createCube()
           
protected  Shape3D getPart(int partIndex)
           
 int getPartCount()
           
 java.lang.Object getScene()
          Returns the 3D scene of the cube.
protected  void init()
           
protected abstract  void initActions()
           
protected abstract  void initCenter()
           
protected abstract  void initCorners()
           
protected abstract  void initEdges()
           
protected abstract  void initSides()
           
protected abstract  void initTransforms()
           
 boolean isInStartedPlayer()
          Returns true if the cube is in a started script player.
 void setInStartedPlayer(boolean newValue)
          This is set to true by the script player if it is started.
 void setMode(int mode)
           
 void setStickerBeveling(float newValue)
           
protected  void updateAlphaBeta()
           
 void updateAttributes()
           
 void updateCube()
           
protected  void updateExplosionFactor(float factor)
           
protected abstract  void updatePartsFillColor()
          Updates the fill color of the parts.
protected abstract  void updatePartsOutlineColor()
          Updates the outline color of the parts.
protected  void updatePartsVisibility()
          Updates the visible state of the parts.
protected  void updatePartVisibility(int index, float alpha)
          Updates the fill color of a part.
protected  void updateScaleFactor(float factor)
           
 void updateStickersFillColor()
          Updates the fill color of the stickers.
protected  void updateStickersImage()
          Updates the sticker imagery.
protected  void updateStickerVisibility(int index, float alpha)
           
protected  void validateTwist(int[] partIndices, int[] locations, int[] orientations, int length, int axis, int angle, float alpha)
           
 
Methods inherited from class ch.randelshofer.rubik.AbstractCube3D
addChangeListener, addCube3DListener, createAttributes, cubeChanged, cubeTwisted, dispatch, dispose, fireActionPerformed, fireMouseEntered, fireMouseExited, fireMousePressed, fireMouseReleased, fireStateChanged, getAnimator, getAttributes, getCube, getDispatcher, getLock, getPartFaceIndexForStickerIndex, getPartIndexForStickerIndex, getStickerCount, 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

cornerCount

protected int cornerCount

edgeCount

protected int edgeCount

sideCount

protected int sideCount

centerCount

protected int centerCount

partCount

protected int partCount

cornerOffset

protected int cornerOffset

edgeOffset

protected int edgeOffset

sideOffset

protected int sideOffset

centerOffset

protected int centerOffset

HALF_PI

protected static final double HALF_PI
See Also:
Constant Field Values

PI

protected final double PI
See Also:
Constant Field Values

shapes

protected Shape3D[] shapes

identityTransforms

protected Transform3D[] identityTransforms

transforms

protected TransformNode3D[] transforms

scene

protected Scene3D scene

isInStartedPlayer

protected boolean isInStartedPlayer

TWIST_MODE

public static final int TWIST_MODE
See Also:
Constant Field Values

PARTS_MODE

public static final int PARTS_MODE
See Also:
Constant Field Values

mode

protected int mode
Constructor Detail

AbstractCubeGeom3D

public AbstractCubeGeom3D(int layerCount,
                          int cornerCount,
                          int edgeCount,
                          int sideCount,
                          int centerCount)
Creates a new instance.

Method Detail

init

protected final void init()

createCube

protected abstract Cube createCube()

initCorners

protected abstract void initCorners()

initEdges

protected abstract void initEdges()

initSides

protected abstract void initSides()

initCenter

protected abstract void initCenter()

initTransforms

protected abstract void initTransforms()

initActions

protected abstract void initActions()

getScene

public java.lang.Object getScene()
Description copied from class: AbstractCube3D
Returns the 3D scene of the cube. We return an Object type here, because the type of the 3D scene depends on the 3D engine used.

Specified by:
getScene in interface Cube3D
Specified by:
getScene in class AbstractCube3D

getPart

protected Shape3D getPart(int partIndex)

getPartCount

public int getPartCount()

updateCube

public void updateCube()
Specified by:
updateCube in class AbstractCube3D

computeTransformation

protected abstract void computeTransformation()

updateExplosionFactor

protected void updateExplosionFactor(float factor)
Specified by:
updateExplosionFactor in class AbstractCube3D

updateScaleFactor

protected void updateScaleFactor(float factor)
Specified by:
updateScaleFactor in class AbstractCube3D

updateAttributes

public final void updateAttributes()
Specified by:
updateAttributes in class AbstractCube3D

updatePartsFillColor

protected abstract void updatePartsFillColor()
Updates the fill color of the parts.


updatePartsOutlineColor

protected abstract void updatePartsOutlineColor()
Updates the outline color of the parts.


updateStickersFillColor

public final void updateStickersFillColor()
Updates the fill color of the stickers.


updatePartsVisibility

protected final void updatePartsVisibility()
Updates the visible state of the parts.


updatePartVisibility

protected final void updatePartVisibility(int index,
                                          float alpha)
Updates the fill color of a part. The part Index is interpreted according to the scheme used by method getPart(int);

Specified by:
updatePartVisibility in class AbstractCube3D

updateStickerVisibility

protected final void updateStickerVisibility(int index,
                                             float alpha)
Specified by:
updateStickerVisibility in class AbstractCube3D

updateStickersImage

protected final void updateStickersImage()
Description copied from class: AbstractCube3D
Updates the sticker imagery.

Specified by:
updateStickersImage in class AbstractCube3D

setMode

public final void setMode(int mode)

updateAlphaBeta

protected void updateAlphaBeta()
Specified by:
updateAlphaBeta in class AbstractCube3D

validateTwist

protected void validateTwist(int[] partIndices,
                             int[] locations,
                             int[] orientations,
                             int length,
                             int axis,
                             int angle,
                             float alpha)

setStickerBeveling

public void setStickerBeveling(float newValue)

setInStartedPlayer

public void setInStartedPlayer(boolean newValue)
Description copied from interface: Cube3D
This is set to true by the script player if it is started.


isInStartedPlayer

public boolean isInStartedPlayer()
Description copied from interface: Cube3D
Returns true if the cube is in a started script player.


(c) Werner Randelshofer.
All rights reserved.