3D Projection Vol. 2 © LGPL

This project uses axonometric projection for more accurate 3D.

  • 1 respect

Components and supplies

About this project

3D Projection

3D Projection is any method of mapping three-dimensional points to a two-dimensional plane. As most current methods for displaying graphical data are based on planar two-dimensional media, the use of this type of projection is widespread, especially in computer graphics and engineering.

Axonometric Projection

Axonometric projection is a type of parallel projection used for creating a pictorial drawing of an object, where the object is rotated along one or more of its axes relative to the plane of projection. There are three main types of axonometric projection: isometric, dimetric, and trimetric projection. "Axonometric" means "to measure along axes". Axonometric projection shows an image of an object as viewed from a skew direction in order to reveal more than one side in the same picture. Whereas the term orthographic is sometimes reserved specifically for depictions of objects where the axis or plane of the object is parallel with the projection plane, in axonometric projection the plane or axis of the object is always drawn not parallel to the projection plane.

With axonometric projections the scale of distant features is the same as for near features, so such pictures will look distorted, as it is not how our eyes or photography work. This distortion is especially evident if the object to view is mostly composed of rectangular features. Despite this limitation, axonometric projection can be useful for purposes of illustration.

Window to viewport coordinate transformation

A world-coordinate area selected for display is called a window. An area on a display device to which a window is mapped is called a viewport. The window defines what is to be viewed; the viewport defines where it is to be displayed.

The window-to-viewport mapping. A point at position (xw, yw) in the window is mapped into position (xv, yv) in the associated viewport. To maintain the same relative placement in the viewport as in the window, we require that

xv - xvmin / xvmax - xvmin = xw - xwmin / xwmax - xwmin
yv - yvmin / yvmax - yvmin = yw - ywmin / ywmax - ywmin

Solving these expressions for the viewport position (xv, yv), we have Ecuation A

xv = xvmin + (xw - xwmin)sx<_e_0chM>yv = yvmin + (yw - ywmin)sy

where the scaling factors are:

sx = xvmax - xvmin / xwmax - xwmin
sy = yvmax - yvmin / ywmax - ywmin

Equations A can also be derived with a set of transformations that converts the window area into the viewport area. This conversion is performed with the following sequence of transformations:

1. Perform a scaling transformation using a fixed-point position of (xwmin, ywmin) that scales the window area to the size of the viewport.

2. Translate the scaled window area to the position of the viewport. Relative proportions of objects are maintained if the scaling factors are the same (sx = sy). Otherwise, world objects will be stretched or contracted in either the x or y direction when displayed on the output device.

The Focal Length

In optics, this word is defined as the distance from the lens node to the point at which a ray, which was initially parallel to the optical axis, intercepts the axis after being deflected by the lens. The focal length is given by:

Fl = p x q  / p + q 


This is the process of producing an image based on three-dimensional data stored within a computer. 3D rendering is a creative process that is similar to photography or cinematography, because you are lighting and staging scenes and producing images.

The three dimensional data that is reproduce could be a complete scene including geometric models of different three dimensional objects, buildings, landscapes, and animated characters - artists need to create this scene by modeling and animating before the rendering can be done. The 3D rendering process depicts this three-dimensional scene as a picture, taken from a specified location and perspective.

Rendering sometimes takes a long time, even on very fast computers. This is because the software is essentially "photographing" each pixel of the image.


Basic Schematic
3d proj bb ggweskwsbh wepso2o5xq


*	Author		: Zavala Ortiz Vicente Arturo.
*	language	: .ino
*	Date		: 4/25/2013 2:51:45 PM
*	Name		: ATmega32u4_3DProjection.ino
*	Description : 3D projection

#include <avr/io.h>
#include <avr/pgmspace.h>

#include "TFT.h"
#include "3D_Math.h"

void init_prespective(double Psi, double Theta, double Phi, double rotPsi, double rotTheta, double rotPhi);
void cube_3D();

#define KEYBOARD_MASK										0xF0


VECTOR_3D pts3D;
double Psi, Theta, Phi, rotPsi, rotTheta, rotPhi;

volatile uint8_t INT_BITS;
uint8_t option;

void setup()
	/* add setup code here */
	3D.setViewport(-4, 4, -3, 3, 0, 200, 50, 250);
	init_prespective(Psi, Theta, Phi, rotPsi, rotTheta, rotPhi);
	Psi			= 75;
	Theta		= 0;
	Phi			= 165;
	rotPsi		= Psi;
	rotTheta	= Theta;
	rotPhi		= Phi;

	// Enable external pin interrupts
	set_bit_port(PCICR, PCIE0);
	set_bit_port(PCMSK0, PCINT4);
	set_bit_port(PCMSK0, PCINT5);
	set_bit_port(PCMSK0, PCINT6);

void loop()
	/* add main program code here */	
	if(INT_BITS != 0)
			case 0x10:
				if((Psi += 25) > 360) Psi = 0.0;				

			case 0x20:		
				if((Theta += 25) > 360) Theta = 0.0;

			case 0x40:		
				if((Phi += 25) > 360) Phi = 0.0;				
		init_prespective(Psi, Theta, Phi, rotPsi, rotTheta, rotPhi);
			case 10 :
			  	RadialWave_3D();	// Radial Wave
			case 20 :
				cube_3D();					// Cube
			case 30 :
			  Sphere_3D();        // Sphere
			case 40 :
			  Torus_3D();         // Torus

		option = INT_BITS;
		_delay_ms(5);			// Switch debounce


Similar projects you might like

Plant Communicator

Project tutorial by Arduino

  • 0 respects

The Nerd

Project tutorial by Arduino

  • 1 comment
  • 0 respects

LED Matrix Display Badge

Project tutorial by FabLabAQ

  • 2 respects

PICASO 4.0 The Infinite X- Axis CNC Wall Engraver

Project tutorial by Arnab Kumar Das

  • 1 comment
  • 1 respect

Object Tracker and Updater

by Rupin Chheda

  • 1 comment
  • 1 respect

Temperature Control

Project tutorial by reteprelleum

  • 1 comment
  • 7 respects
Add projectSign up / Login