# 0.2 Graphic composition in processing  (Page 6/8)

 Page 6 / 8

## Perspective projections

A perspective projection is defined by a center of projection and a plane of projection . The projector rays connect the points in the scene with the center of projection, thus highlighting thecorresponding points in the plane of projection. The [link] shows a section where the plane of projection produces a straight line whose abscissa is $-d$ , and the center of projection is in the origin.

By similarity of two triangles it is easy to realize that the point having ordinate $y$ gets projected onto the plane in the point having ordinate ${y}_{p}=-\left(\frac{yd}{z}\right)$ .

In general, the projection of a point having homogeneous coordinates $\left(\begin{array}{c}x\\ y\\ z\\ 1\end{array}\right)$ onto a plane orthogonal to the $z$ axis and intersecting such axis in position $-d$ is obtained, in homogeneous coordinates, by multiplication with the matrix $\begin{pmatrix}1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 1 & 0\\ 0 & 0 & -\left(\frac{1}{d}\right) & 0\\ \end{pmatrix}$ . The projected point becomes $\left(\begin{array}{c}x\\ y\\ z\\ -\left(\frac{z}{d}\right)\end{array}\right)$ , which can be normalized by multiplication of all its element by $-\left(\frac{d}{z}\right)$ . As a result, we obtain $\left(\begin{array}{c}-\left(\frac{xd}{z}\right)\\ -\left(\frac{yd}{z}\right)\\ -d\\ 1\end{array}\right)$

## Parallel views

Parallel views are obtained by taking the center of projection back to infinity (  ). In this way, the projector rays are all parallel.

## Orthographic projection

The orthographic projection produces a class of parallel views by casting projection rays orthogonal to the planeof projection. If such plane is positioned orthogonally to the $z$ axis and passing by the origin, the projection matrix turns out to beparticolarly simple: $\begin{pmatrix}1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 1\\ \end{pmatrix}$ . Among orthographic projections, the axonometric projections are based on the possibility to measure the object along three orthogonalaxes, and on the orientation of the plane of projection with respect to these axes. In particular, in the isometric projection the projections of the axes form angles of $120°$ . The isometric projection has the property that equal segments on the three axes remain equal when theyare projected onto the plane. In order to obtain the isometric projection of an object whose main axes areparallel to the coordinate axes, we can first rotate the object by $45°$ about the $y$ axis, and then rotate by $\arctan \left(\frac{1}{\sqrt{2}}\right)=35.264°$ about the $x$ axis.

## Oblique projection

We can talk about oblique projection every time the projector rays are oblique (non-orthogonal) to the projection plane. In order to deviate the projector rays from the normal direction by the angles $\theta$ and $\phi$ we must use a projection matrix $\begin{pmatrix}1 & 0 & -\tan \theta & 0\\ 0 & 1 & -\tan \phi & 0\\ 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 1\\ \end{pmatrix}$

As we have seen, Processing has a local illumination model, thus being impossible to cast shadows directly. However, bymanipulating the affine transformation matrices we can cast shadows onto planes. The method is called flashing in the eye , thus meaning that the optical center of the scene is moved to the point where the light source ispositioned, and then a perspective transformation is made, with a plane of projection that coincides with the planewhere we want to cast the shadow on.

The following program projects on the floor the shadow produced by a light source positioned on the $y$ axis. The result is shown in [link]

size(200, 200, P3D); float centro = 100;float yp = 70; //floor (plane of projection) distance from center float yl = 40; //height of light (center of projection) from centertranslate(centro, centro, 0); //center the world on the cube noFill();box(yp*2); //draw of the room pushMatrix();fill(250); noStroke(); translate(0, -yl, 0); // move the virtual light bulb highersphere(4); //draw of the light bulb stroke(10);popMatrix(); pushMatrix(); //draw of the wireframe cubenoFill(); rotateY(PI/4); rotateX(PI/3);box(20); popMatrix();// SHADOW PROJECTION BY COMPOSITION // OF THREE TRANSFORMATIONS (the first one in// the code is the last one to be applied) translate(0, -yl, 0); // shift of the light source and the floor back// to their place (see the translation below) applyMatrix(1, 0, 0, 0,0, 1, 0, 0, 0, 0, 1, 0,0, 1/(yp+yl), 0, 0); // projection on the floor // moved down by yltranslate(0, yl, 0); // shift of the light source to center // and of the floor down by ylpushMatrix(); // draw of the cube that generate the shadow fill(120, 50); // by means of the above transformationsnoStroke(); rotateY(PI/4); rotateX(PI/3);box(20); popMatrix();

how can chip be made from sand
is this allso about nanoscale material
Almas
are nano particles real
yeah
Joseph
Hello, if I study Physics teacher in bachelor, can I study Nanotechnology in master?
no can't
Lohitha
where is the latest information on a no technology how can I find it
William
currently
William
where we get a research paper on Nano chemistry....?
nanopartical of organic/inorganic / physical chemistry , pdf / thesis / review
Ali
what are the products of Nano chemistry?
There are lots of products of nano chemistry... Like nano coatings.....carbon fiber.. And lots of others..
learn
Even nanotechnology is pretty much all about chemistry... Its the chemistry on quantum or atomic level
learn
da
no nanotechnology is also a part of physics and maths it requires angle formulas and some pressure regarding concepts
Bhagvanji
hey
Giriraj
Preparation and Applications of Nanomaterial for Drug Delivery
revolt
da
Application of nanotechnology in medicine
has a lot of application modern world
Kamaluddeen
yes
narayan
what is variations in raman spectra for nanomaterials
ya I also want to know the raman spectra
Bhagvanji
I only see partial conversation and what's the question here!
what about nanotechnology for water purification
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
Damian
yes that's correct
Professor
I think
Professor
Nasa has use it in the 60's, copper as water purification in the moon travel.
Alexandre
nanocopper obvius
Alexandre
what is the stm
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
Rafiq
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
Damian
How we are making nano material?
what is a peer
What is meant by 'nano scale'?
What is STMs full form?
LITNING
scanning tunneling microscope
Sahil
how nano science is used for hydrophobicity
Santosh
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
Rafiq
what is differents between GO and RGO?
Mahi
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
Rafiq
if virus is killing to make ARTIFICIAL DNA OF GRAPHENE FOR KILLED THE VIRUS .THIS IS OUR ASSUMPTION
Anam
analytical skills graphene is prepared to kill any type viruses .
Anam
Any one who tell me about Preparation and application of Nanomaterial for drug Delivery
Hafiz
what is Nano technology ?
write examples of Nano molecule?
Bob
The nanotechnology is as new science, to scale nanometric
brayan
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Damian
how did you get the value of 2000N.What calculations are needed to arrive at it
Privacy Information Security Software Version 1.1a
Good
Got questions? Join the online conversation and get instant answers!