This Library for DOGS-102 Graphic LCD module. Based on Igor Skochinsky's "DOGLCDDemo" program.

Dependents:   DOGS102_Example1 DOGS102_Example2

Fork of DOGLCDDemo by Igor Skochinsky

Committer:
ban4jp
Date:
Sat May 03 16:04:16 2014 +0000
Revision:
1:2145a74df666
Parent:
0:2a5dccfd318f
Change to library, and Support DOGS-102 Graphic LCD module.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
igorsk 0:2a5dccfd318f 1 /*
igorsk 0:2a5dccfd318f 2 * libmbed-graphics 2D and wireframe 3D graphics library for the MBED
igorsk 0:2a5dccfd318f 3 * microcontroller platform
igorsk 0:2a5dccfd318f 4 * Copyright (C) <2009> Michael Sheldon <mike@mikeasoft.com>
igorsk 0:2a5dccfd318f 5 *
igorsk 0:2a5dccfd318f 6 * This library is free software; you can redistribute it and/or
igorsk 0:2a5dccfd318f 7 * modify it under the terms of the GNU Library General Public
igorsk 0:2a5dccfd318f 8 * License as published by the Free Software Foundation; either
igorsk 0:2a5dccfd318f 9 * version 2 of the License, or (at your option) any later version.
igorsk 0:2a5dccfd318f 10 *
igorsk 0:2a5dccfd318f 11 * This library is distributed in the hope that it will be useful,
igorsk 0:2a5dccfd318f 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
igorsk 0:2a5dccfd318f 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
igorsk 0:2a5dccfd318f 14 * Library General Public License for more details.
igorsk 0:2a5dccfd318f 15 *
igorsk 0:2a5dccfd318f 16 * You should have received a copy of the GNU Library General Public
igorsk 0:2a5dccfd318f 17 * License along with this library; if not, write to the
igorsk 0:2a5dccfd318f 18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
igorsk 0:2a5dccfd318f 19 * Boston, MA 02111-1307, USA.
igorsk 0:2a5dccfd318f 20 */
igorsk 0:2a5dccfd318f 21
igorsk 0:2a5dccfd318f 22 #ifndef MBED_OBJECT3D_H
igorsk 0:2a5dccfd318f 23 #define MBED_OBJECT3D_H
igorsk 0:2a5dccfd318f 24
igorsk 0:2a5dccfd318f 25 #include "Graphics.h"
igorsk 0:2a5dccfd318f 26
igorsk 0:2a5dccfd318f 27 /* Class: Object3D
igorsk 0:2a5dccfd318f 28 * General purpose 3D base object, new 3D objects should inherit
igorsk 0:2a5dccfd318f 29 * from this class.
igorsk 0:2a5dccfd318f 30 */
igorsk 0:2a5dccfd318f 31 class Object3D {
igorsk 0:2a5dccfd318f 32
igorsk 0:2a5dccfd318f 33 public:
igorsk 0:2a5dccfd318f 34 Object3D();
igorsk 0:2a5dccfd318f 35
igorsk 0:2a5dccfd318f 36 /* Function: position
igorsk 0:2a5dccfd318f 37 * Specify the position of the object in 3D space.
igorsk 0:2a5dccfd318f 38 *
igorsk 0:2a5dccfd318f 39 * Parameters:
igorsk 0:2a5dccfd318f 40 * x - X co-ordinate of the point that the centre of the object should be placed at.
igorsk 0:2a5dccfd318f 41 * y - Y co-ordinate of the point that the centre of the object should be placed at.
igorsk 0:2a5dccfd318f 42 * z - Z co-ordinate of the point that the centre of the object should be placed at.
igorsk 0:2a5dccfd318f 43 */
igorsk 0:2a5dccfd318f 44 void position(int x, int y, int z);
igorsk 0:2a5dccfd318f 45
igorsk 0:2a5dccfd318f 46 /* Function: rotate
igorsk 0:2a5dccfd318f 47 * Rotate the object about it's centre point.
igorsk 0:2a5dccfd318f 48 *
igorsk 0:2a5dccfd318f 49 * Parameters:
igorsk 0:2a5dccfd318f 50 * rx - Component of the rotation along the x-axis in radians.
igorsk 0:2a5dccfd318f 51 * ry - Component of the rotation along the y-axis in radians.
igorsk 0:2a5dccfd318f 52 * rz - Component of the rotation along the z-axis in radians.
igorsk 0:2a5dccfd318f 53 */
igorsk 0:2a5dccfd318f 54 void rotate(float rx, float ry, float rz);
igorsk 0:2a5dccfd318f 55
igorsk 0:2a5dccfd318f 56 /* Function: scale
igorsk 0:2a5dccfd318f 57 * Modify the size of the object.
igorsk 0:2a5dccfd318f 58 *
igorsk 0:2a5dccfd318f 59 * Parameters:
igorsk 0:2a5dccfd318f 60 * sx - Proportion to change the object's size by along the x axis.
igorsk 0:2a5dccfd318f 61 * sy - Proportion to change the object's size by along the y axis.
igorsk 0:2a5dccfd318f 62 * sz - Proportion to change the object's size by along the z axis.
igorsk 0:2a5dccfd318f 63 */
igorsk 0:2a5dccfd318f 64 void scale(float sx, float sy, float sz);
igorsk 0:2a5dccfd318f 65
igorsk 0:2a5dccfd318f 66 /* Function: colour
igorsk 0:2a5dccfd318f 67 * Sets the colour of the object.
igorsk 0:2a5dccfd318f 68 *
igorsk 0:2a5dccfd318f 69 * Parameters:
igorsk 0:2a5dccfd318f 70 * colour - The colour of the object.
igorsk 0:2a5dccfd318f 71 */
igorsk 0:2a5dccfd318f 72 void colour(int colour);
igorsk 0:2a5dccfd318f 73
igorsk 0:2a5dccfd318f 74 /* Function: render
igorsk 0:2a5dccfd318f 75 * Draws the object on the specified graphical context.
igorsk 0:2a5dccfd318f 76 *
igorsk 0:2a5dccfd318f 77 * Parameters:
igorsk 0:2a5dccfd318f 78 * g - The graphical context to which the object should be rendered.
igorsk 0:2a5dccfd318f 79 */
igorsk 0:2a5dccfd318f 80 virtual void render(Graphics &g) = 0;
igorsk 0:2a5dccfd318f 81
igorsk 0:2a5dccfd318f 82 protected:
igorsk 0:2a5dccfd318f 83 int _x, _y, _z;
igorsk 0:2a5dccfd318f 84 float _rx, _ry, _rz;
igorsk 0:2a5dccfd318f 85 float _sx, _sy, _sz;
igorsk 0:2a5dccfd318f 86 int _colour;
igorsk 0:2a5dccfd318f 87 };
igorsk 0:2a5dccfd318f 88
igorsk 0:2a5dccfd318f 89
igorsk 0:2a5dccfd318f 90 /* Function: rotate3d
igorsk 0:2a5dccfd318f 91 * Rotates point(s) in 3D space about origin (0,0,0)
igorsk 0:2a5dccfd318f 92 *
igorsk 0:2a5dccfd318f 93 * Parameters:
igorsk 0:2a5dccfd318f 94 * x - Pointer to the x co-ordinate(s) of the point(s) to be rotated.
igorsk 0:2a5dccfd318f 95 * y - Pointer to the y co-ordinate(s) of the point(s) to be rotated.
igorsk 0:2a5dccfd318f 96 * z - Pointer to the z co-ordinate(s) of the point(s) to be rotated.
igorsk 0:2a5dccfd318f 97 * anglex - The angle to rotate the point by around axis x in radians.
igorsk 0:2a5dccfd318f 98 * angley - The angle to rotate the point by around axis y in radians.
igorsk 0:2a5dccfd318f 99 * anglez - The angle to rotate the point by around axis z in radians.
igorsk 0:2a5dccfd318f 100 * count - count of coordinates pointed to by x, y and z
igorsk 0:2a5dccfd318f 101 */
igorsk 0:2a5dccfd318f 102 void rotate3d(int *x, int *y, int *z, float anglex, float angley, float anglez, int count = 1);
igorsk 0:2a5dccfd318f 103
igorsk 0:2a5dccfd318f 104 #endif