CubeTwister 2.0alpha142 2012-02-11

ch.randelshofer.rubik
Class VCube7Idx3D

java.lang.Object
  extended by ch.randelshofer.rubik.AbstractCube3D
      extended by ch.randelshofer.rubik.AbstractCubeIdx3D
          extended by ch.randelshofer.rubik.AbstractCube7Idx3D
              extended by ch.randelshofer.rubik.VCube7Idx3D
All Implemented Interfaces:
Cube3D, CubeListener, java.beans.PropertyChangeListener, java.util.EventListener, javax.swing.event.ChangeListener

public class VCube7Idx3D
extends AbstractCube7Idx3D

Geometrical representation of Cube7 as a V-Cube 7 in three dimensions.

The faces of a V-Cube 7 are curved. This class constructs the faces from six intersecting spheres.

Version:
1.1 2010-04-04 Added swipe actions to edges adjacent to stickers.
2009-04-13 Fixed uv-map of drb corner.
2008-08-15 Created.
Author:
Werner Randelshofer

Nested Class Summary
 
Nested classes/interfaces inherited from class ch.randelshofer.rubik.AbstractCube3D
AbstractCube3D.PartAction, AbstractCube3D.SwipeAction
 
Field Summary
 
Fields inherited from class ch.randelshofer.rubik.AbstractCube7Idx3D
BEVEL_LENGTH, PART_LENGTH
 
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
VCube7Idx3D()
           
 
Method Summary
protected  CubeAttributes createAttributes()
          Creates cube attributes (e.g.
 CubeKind getKind()
          Gets the kind of the cube.
protected  int getPartFaceIndexForStickerIndex(int stickerIndex)
           
 int getPartIndexForStickerIndex(int stickerIndex)
           
protected  int getStickerCount()
           
protected  int getStickerIndexForPart(int part, int orientation)
           
 void init()
           
protected  void initActions(idx3d_Scene scene)
           
protected  void initCorners()
           
protected  void initCornerUVMap()
          Initalizes the Corner UV Map.
protected  void initEdges()
           
protected  void initEdgeUVMap()
          Initializes the UV Map for the edge parts.
protected  void initSides()
           
protected  void initSideUVMap()
          Initializes the UV coordinates for the side parts.
 void setStickerBeveling(float newValue)
          Specifies how many pixels are cut off from the stickers image for each sticker.
protected  void updatePartOutlineColor(int index, java.awt.Color c)
          Updates the fill color of a part.
protected  void updatePartVisibility(int index, float alpha)
          Updates the visibility of a part.
protected  void updateStickerFillColor(int index, java.awt.Color c)
           
protected  void updateStickerVisibility(int index, float alpha)
          Updates the visibility of a sticker.
 
Methods inherited from class ch.randelshofer.rubik.AbstractCube7Idx3D
cubeTwisted, getUnitScaleFactor, initCenter, initTransforms, validateTwist
 
Methods inherited from class ch.randelshofer.rubik.AbstractCubeIdx3D
dispose, getLock, getPart, getPartCount, getScene, isInStartedPlayer, setInStartedPlayer, updateAlphaBeta, updateAttributes, updateCube, updateExplosionFactor, updateExplosionFactor, updatePartFillColor, updatePartsFillColor, updatePartsVisibility, updateScaleFactor, updateScaleFactor, updateStickersFillColor, updateStickersImage, validateAlphaBeta, validateAttributes, validateCube, validateScaleFactor, validateStickersImage
 
Methods inherited from class ch.randelshofer.rubik.AbstractCube3D
addChangeListener, addCube3DListener, 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
 

Constructor Detail

VCube7Idx3D

public VCube7Idx3D()
Method Detail

init

public void init()
Overrides:
init in class AbstractCube7Idx3D

initCorners

protected void initCorners()
Specified by:
initCorners in class AbstractCube7Idx3D

initCornerUVMap

protected void initCornerUVMap()
Initalizes the Corner UV Map.
    0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20  21
  0                             +---+---+---+---+---+---+---+
                                |4.0|                   |2.0|  
  1                             +---+                   +---+
                                |                           |
  2                             +                           +
                                |                           |
  3                             +                           +
                                |             u             |
  4                             +                           +
                                |                           |
  5                             +                           +
                                |                           |
  6                             +---+                   +---+
                                |6.0|                   |0.0|  
  7 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+...........................+
    |4.1|                   |6.2|6.1|                   |0.2|0.1|                   |2.2|                           '
  8 +---+                   +---+---+                   +---+---+                   +---+                           '
    |                           |                           |                           |                           '
  9 +                           +                           +                           +                           '
    |                           |                           |                           |                           '
 10 +                           +                           +                           +                           '
    |             l             |             f             |             r             |             b             '
 11 +                           +                           +                           +                           '
    |                           |                           |                           |                           '
 12 +                           +                           +                           +                           '
    |                           |                           |                           |                           '
 13 +---+                   +---+---+                   +---+---+                   +---+                           '
    |5.2|                   |7.1|7.2|                   |1.1|1.2|                   |3.1|                           '
 14 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+...........................+
                                |7.0|                   |1.0|2.1|                   |4.2|     |
 15                             +---+                   +---+---+                   +---+     |
                                |                           |                           |     |
 16                             +                           +                           +     |
                                |                           |                           |     |
 17                             +                           +                           +     |
                                |             d             |             b             |  <--+
 18                             +                           +                           +     
                                |                           |                           |     
 19                             +                           +                           +     
                                |                           |                           |     
 20                             +---+                   +---+---+                   +---+
                                |5.0|                   |3.0|3.2|                   |5.1|
 21                             +---+---+---+---+---+---+---+---+---+---+---+---+---+---+
 


initEdges

protected void initEdges()
Specified by:
initEdges in class AbstractCube7Idx3D

initEdgeUVMap

protected void initEdgeUVMap()
Initializes the UV Map for the edge parts.
   0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20  21
 0                             +---+---+---+---+---+---+---+
                               |   |   |   |3.1|   |   |   |
 1                             +--- ---+---+---+---+--- ---+
                               |   |                   |   |
 2                             +---+                   +---+
                               |   |                   |   |
 2                             +---+                   +---+
                               |6.0|         u         |0.0|
 2                             +---+                   +---+
                               |   |                   |   |
 2                             +---+                   +---+
                               |   |                   |   |
 1                             +--- ---+---+---+---+--- ---+
                               |   |   |   |9.1|   |   |   |
 3 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+...........................+
   |   |   |   |6.1|   |   |   |   |   |   |9.0|   |   |   |   |48 |24 |0.1|12 |36 |   |                           '
 4 +--- ---+---+---+---+--- ---+--- ---+---+---+---+--- ---+--- ---+---+---+---+--- ---+                           '
   |   |                   |   |   |                   |   |   |                   |   |                           '
   +---+                   +---+---+                   +---+---+                   +---+                           '       
   |   |                   |   |   |                   |   |   |                   |   |                           '
   +---+                   +---+---+                   +---+---+                   +---+                           '       
   |7.0|         l         10.0|10.1         f         |1.1|1.0|         r         |4.0|             b             '
   +---+                   +---+---+                   +---+---+                   +---+                           '       
   |   |                   |   |   |                   |   |   |                   |   |                           '
   +---+                   +---+---+                   +---+---+                   +---+                           '       
   |   |                   |   |   |                   |   |   |                   |   |                           '
 4 +--- ---+---+---+---+--- ---+--- ---+---+---+---+--- ---+--- ---+---+---+---+--- ---+                           '
   |   |   |   |8.1|   |   |   |   |   |   |11.0   |   |   |   |   |   |2.1|   |   |   |                           '
 3 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+...........................+
                               |   |   |   |11.1   |   |   |   |   |   |3.0|   |   |   |     |
 7                             +--- ---+---+---+---+--- ---+--- ---+---+---+---+--- ---+     |
                               |   |                   |   |   |                   |   |     |
                               +---+                   +---+---+                   +---+     |
                               |   |                   |   |   |                   |   |     |
                               +---+                   +---+---+                   +---+     |
                               |8.0|         d         |2.0|4.1|         b         |7.1|  <--+
                               +---+                   +---+---+                   +---+     
                               |   |                   |   |   |                   |   |     
                               +---+                   +---+---+                   +---+     
                               |   |                   |   |   |                   |   |     
 8                             +--- ---+---+---+---+--- ---+--- ---+---+---+---+--- ---+
                               |   |   |   |5.1|   |   |   |   |   |   |5.0|   |   |   |
 9                             +---+---+---+---+---+---+---+---+---+---+---+---+---+---+
 


initSides

protected void initSides()
Specified by:
initSides in class AbstractCube7Idx3D

initSideUVMap

protected void initSideUVMap()
Initializes the UV coordinates for the side parts.


getPartIndexForStickerIndex

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

getPartFaceIndexForStickerIndex

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

getStickerIndexForPart

protected int getStickerIndexForPart(int part,
                                     int orientation)

getStickerCount

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

createAttributes

protected CubeAttributes createAttributes()
Description copied from class: AbstractCube3D
Creates cube attributes (e.g. colors, sticker pictures, ...).

Specified by:
createAttributes in class AbstractCube3D

updatePartOutlineColor

protected void updatePartOutlineColor(int index,
                                      java.awt.Color c)
Updates the fill color of a part. The part Index is interpreted according to the scheme used by method getPart(int);

Overrides:
updatePartOutlineColor in class AbstractCubeIdx3D

updateStickerFillColor

protected void updateStickerFillColor(int index,
                                      java.awt.Color c)
Overrides:
updateStickerFillColor in class AbstractCubeIdx3D

updateStickerVisibility

protected void updateStickerVisibility(int index,
                                       float alpha)
Updates the visibility of a sticker.

Overrides:
updateStickerVisibility in class AbstractCubeIdx3D

updatePartVisibility

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

Overrides:
updatePartVisibility in class AbstractCubeIdx3D

initActions

protected void initActions(idx3d_Scene scene)
Specified by:
initActions in class AbstractCube7Idx3D

setStickerBeveling

public void setStickerBeveling(float newValue)
Specifies how many pixels are cut off from the stickers image for each sticker.

Specified by:
setStickerBeveling in interface Cube3D
Specified by:
setStickerBeveling in class AbstractCubeIdx3D

getKind

public CubeKind getKind()
Description copied from interface: Cube3D
Gets the kind of the cube.


(c) Werner Randelshofer.
All rights reserved.