RSS
 

lib3d.h

#ifndef lib3d_h
#define lib3d_h

#define  MAX_LINES    10

class Point3D
{
 public:
 short      x;
 short    y;
 short    z;
};

class Line3D
{
 public:
 Line3D();
 Line3D(short x1, short y1, short z1, short x2, short y2, short z2);
 Point3D    p1;
 Point3D    p2;
};

class Scene3D
{
 public:
 Scene3D();
 void CreateScene(short resX, short resY, TVout* pTVout);
 void UpdateDisplay();
 void AddLine(Line3D line);
 void AddCube(short cX, short cY, short cZ, short edgeLen);
 void AddSphere(float r, Point3D c);
 void SetVAngle(float vNew);
 void SetHAngle(float hNew);

 private:
 TVout*    pTV;
 Line3D    lines[MAX_LINES];        // all the lines in a 3D wireframe model
 short       iNumLines;
 short    mv;        // middle vertically
 short    mh;        // the horizontal middle

 float    h;        // the angles
 float    v;         

 float    cosh;        // precalculated trig values for xyztox and xyztoy functions
 float    sinh;
 float    cosv;
 float    sinv;        

 int xyztox(short x, short y, short z);
 int xyztoy(short x, short y, short z);
 void UpdateConsts();
};

#endif

Leave a Reply

 

 
  1. Nunchuck Controlled 3D cube on TV « Paul's Arduino

    January 5, 2011 at 11:49 pm

    [...] code libraryAnalogue Clocklib3d.cpplib3d.hNunchuck 3DPOV Source codeScrolling Digital ClockThermometer and Clock   RSS [...]

     
  2. Arduino Blog » Blog Archive » Nunchuck Controlled 3D Cube On TV

    January 6, 2011 at 5:15 pm

    [...] arduino, then the cube is redrawn according to new angle of the controller. 3d wireframe library header and source. Code to tie everything [...]

     
  3. Nunchuck Controlled 3D Cube On TV | dev.SquareCows.com

    January 7, 2011 at 1:44 am

    [...] arduino, then the cube is redrawn according to new angle of the controller. 3d wireframe library header and source. Code to tie everything [...]