Shape Class Reference

Shape holds the definition of a structure design which can be built using happy cube pieces. More...

#include <Shape.h>

Collaboration diagram for Shape:

Collaboration graph
[legend]
List of all members.

Public Types

enum  EFacing { FACING_OUT = 0, FACING_IN, FACING_UNKNOWN }

Public Member Functions

 Shape ()
 ~Shape ()
EGenResult generate (const BuildWorld *build)
 fill the Shape with content generated from given BuildWorld.
int locateFaceHardWay (EPlane ldr, Coord3d lex) const
 locate face when m_opt_facesLoc is invalidated (after generate completes)
bool createTrasformTo (const Shape *news, TTransformVec &movedTo, bool *trivialTransform)
void deallocate ()
bool saveTo (MyFile *wrfl)
bool loadFrom (MyFile *rdfl)

Public Attributes

Coord3d size
 size in basic units
int fcn
 number of faces
int sdn
 number of sides (edges)
int cnn
 number of corners
int sdnError
 number of Error sides. if there are error sides, "sides" contains the errors and sdn = 0
bool rotfirst
 true if first piece should be rotated
FaceDeffaces
 array of faces
SideDefsides
 array of sides
CornerDefcorners
 array of corners
SideDeferrorSides
 array of error sides.

Private Member Functions

void readAxis (const BuildWorld *build, int iss, int jss, int pgss, EPlane planedr, QLinkedList< FaceDef > &flst, int *reqfirst, SqrLimits &bound)
int checkSide (EAxis ldr, int x, int y, int z, QLinkedList< SideDef > &slst, QLinkedList< SideDef > &slstError)
int checkCorner (int x, int y, int z, QLinkedList< CornerDef > &clst)
void copyFace (Shape::FaceDef src, Shape::FaceDef *dest)
bool makeReverseNei ()
bool makeVolumeAndFacing ()
int locateFace (EPlane ldr, Coord3d lex) const
void faceNei (int whos, int fnei[4])
int faceNeiFirst (int whos, TransType trans[])
int faceNeiFirstOpt (int whos, TransType trans[])
EGenResult reArrangeFacesDFS (FaceDef faces[], FaceDef revis[], TransType trans[])
EGenResult reArrangeFacesBFS (FaceDef faces[], FaceDef revis[], TransType trans[])

Private Attributes

Space3D< int > m_opt_facesLoc [3]
int volume
 volume == 0 means it's an open shape. volume == -1 means it was not calculated

Classes

struct  CornerDef
 CornerDef is the definition of a corner, a point meeting place of several faces. More...
struct  FaceDef
 FaceDef is the definion of a face, A face is a placeholder for a 5x5 happy cube piece. More...
struct  SideDef
 SideDef is the definition of a side, a border between two faces. More...
struct  SideFind
 SideFind is the datum of the normSide lookup table used in Shape::checkSide(). More...
struct  TransType
 TransType holds the data of a transformation from and index to an index. More...

Detailed Description

Shape holds the definition of a structure design which can be built using happy cube pieces.

The basic foundations of the design are the faces it is made of A "face" is a placeholder for a single piece in a specific orientation from the faces data, further data about the sides and corners is extracted. A shape is usually generated from a BuildWorld which is the direct representation of what is designed in the GUI. Shape is used in the solution engine in Cube as the blue print over which the solution is build. It is also used to aid user interaction in BuildWorld

See also:
Cube BuildWorld


Member Enumeration Documentation

Enumerator:
FACING_OUT 
FACING_IN 
FACING_UNKNOWN 


Constructor & Destructor Documentation

Shape::Shape (  )  [inline]

Shape::~Shape (  )  [inline]


Member Function Documentation

EGenResult Shape::generate ( const BuildWorld build  ) 

fill the Shape with content generated from given BuildWorld.

Returns:
A result code according to success or failure of the operation.

int Shape::locateFaceHardWay ( EPlane  ldr,
Coord3d  lex 
) const

locate face when m_opt_facesLoc is invalidated (after generate completes)

bool Shape::createTrasformTo ( const Shape news,
TTransformVec movedTo,
bool *  trivialTransform 
)

void Shape::deallocate (  ) 

bool Shape::saveTo ( MyFile wrfl  ) 

bool Shape::loadFrom ( MyFile rdfl  ) 

void Shape::readAxis ( const BuildWorld build,
int  iss,
int  jss,
int  pgss,
EPlane  planedr,
QLinkedList< FaceDef > &  flst,
int *  reqfirst,
SqrLimits bound 
) [private]

int Shape::checkSide ( EAxis  ldr,
int  x,
int  y,
int  z,
QLinkedList< SideDef > &  slst,
QLinkedList< SideDef > &  slstError 
) [private]

int Shape::checkCorner ( int  x,
int  y,
int  z,
QLinkedList< CornerDef > &  clst 
) [private]

void Shape::copyFace ( Shape::FaceDef  src,
Shape::FaceDef dest 
) [private]

bool Shape::makeReverseNei (  )  [private]

bool Shape::makeVolumeAndFacing (  )  [private]

int Shape::locateFace ( EPlane  ldr,
Coord3d  lex 
) const [private]

void Shape::faceNei ( int  whos,
int  fnei[4] 
) [private]

int Shape::faceNeiFirst ( int  whos,
TransType  trans[] 
) [private]

int Shape::faceNeiFirstOpt ( int  whos,
TransType  trans[] 
) [private]

EGenResult Shape::reArrangeFacesDFS ( FaceDef  faces[],
FaceDef  revis[],
TransType  trans[] 
) [private]

EGenResult Shape::reArrangeFacesBFS ( FaceDef  faces[],
FaceDef  revis[],
TransType  trans[] 
) [private]


Member Data Documentation

Space3D<int> Shape::m_opt_facesLoc[3] [private]

size in basic units

number of faces

number of sides (edges)

number of corners

number of Error sides. if there are error sides, "sides" contains the errors and sdn = 0

true if first piece should be rotated

array of faces

array of sides

array of corners

array of error sides.

int Shape::volume [private]

volume == 0 means it's an open shape. volume == -1 means it was not calculated


The documentation for this class was generated from the following files: