<< Chapter < Page Chapter >> Page >

Collections of triangles

A set of triangles can be defined, similarly to what we did for points and segments, by the delimiters beginShape() and endShape() . Between them, the vertices of the triangles are listed by calls to thefunction vertex() . By the invocation beginShape(TRIANGLES) the vertices are taken in triples, each defining a triangle, while the invocation beginShape(TRIANGLE_STRIP) takes the vertices one after the other to define a strip mad of triangular facets. Ifthe vertex() has three arguments, the vertices are located in the 3D space and the corresponding trianglesidentify planar surfaces in space.

Quadrilaterals

Rectangles are defined, in Processing, by the function rect() of four parameters, where the first couple specifies, by default, the position in the the 2D plane of thetop-left corner, and the third and fourth parameters specify the width and height, respectively. The meaning of the firstcouple of parameters can be changed with the function rectMode() : rectMode(CORNER) gives the default positioning; rectMode(CENTER) gives the positioning of the center of the rectangle at thespecified point; with the rectMode(CORNERS) the four parameters are interpreted as the coordinates of thetop-left and bottom-right vertices, respectively. A generic quadrilateral is defined by the coordinates of its fourvertices, passed as parameters to the function quad() . It is important to notice that in 3D, while a triangle stays planar in any case, a quadruple ofpoints does not necessarily lay on a plane. Viceversa, the quadrilaterals that are defined by 3D roto-translations ofquadruples of 2D vertices, remain planar. Processing allows only eight parameters to be passed to quad() , thus forcing the definition of a quadrilateral as a quadrupleof vertices in 2D.

Collections of quadrilaterals

A set of quadrilaterals can be defined, similarly to what we saw for triangles, by the delimiters beginShape() and endShape() . Between them, vertices are listed by calls to the function vertex() . By using the invocation beginShape(QUADS) the vertices are taken in quadruples, each identifying a quadrilateral, while theinvocation beginShape(QUAD_STRIP) takes the vertices one after the other to define a strip mad ofquadrilateral facets. If the vertex() have three parameters, the planarity of the resulting faces is notensured, and the resulting rendering can be misleading. For instance, by running the code size(200,200,P3D); lights();beginShape(QUADS); vertex(20,31, 33);vertex(80, 40, 38); vertex(75, 88, 50);vertex(49, 85, 74); endShape(); we realize that the quadrilateral is rendered as the juxtaposition of two triangles belonging to differentplanes.

Polygons

A generic polygon is defined as a set of vertices, and it has a surface that can becolored. In Processing the vertices are listed within a couple beginShape(POLYGON); - endShape(); Actually, the polygon has to be intended in a generalized sense, as it is possible to use the bezierVertex() and curveVertex() to specify curved profiles. For instance, the reader may try todraw the moon: fill(246, 168, 20); beginShape(POLYGON);vertex(30, 20); bezierVertex(80, 10, 80, 75, 30, 75);bezierVertex(50, 70, 60, 25, 30, 20); endShape();

Questions & Answers

how do you get the 2/50
Abba Reply
number of sport play by 50 student construct discrete data
Aminu Reply
width of the frangebany leaves on how to write a introduction
Theresa Reply
Solve the mean of variance
Veronica Reply
Step 1: Find the mean. To find the mean, add up all the scores, then divide them by the number of scores. ... Step 2: Find each score's deviation from the mean. ... Step 3: Square each deviation from the mean. ... Step 4: Find the sum of squares. ... Step 5: Divide the sum of squares by n – 1 or N.
kenneth
what is error
Yakuba Reply
Is mistake done to something
Vutshila
Hy
anas
hy
What is the life teble
anas
hy
Jibrin
statistics is the analyzing of data
Tajudeen Reply
what is statics?
Zelalem Reply
how do you calculate mean
Gloria Reply
diveving the sum if all values
Shaynaynay
let A1,A2 and A3 events be independent,show that (A1)^c, (A2)^c and (A3)^c are independent?
Fisaye Reply
what is statistics
Akhisani Reply
data collected all over the world
Shaynaynay
construct a less than and more than table
Imad Reply
The sample of 16 students is taken. The average age in the sample was 22 years with astandard deviation of 6 years. Construct a 95% confidence interval for the age of the population.
Aschalew Reply
Bhartdarshan' is an internet-based travel agency wherein customer can see videos of the cities they plant to visit. The number of hits daily is a normally distributed random variable with a mean of 10,000 and a standard deviation of 2,400 a. what is the probability of getting more than 12,000 hits? b. what is the probability of getting fewer than 9,000 hits?
Akshay Reply
Bhartdarshan'is an internet-based travel agency wherein customer can see videos of the cities they plan to visit. The number of hits daily is a normally distributed random variable with a mean of 10,000 and a standard deviation of 2,400. a. What is the probability of getting more than 12,000 hits
Akshay
1
Bright
Sorry i want to learn more about this question
Bright
Someone help
Bright
a= 0.20233 b=0.3384
Sufiyan
a
Shaynaynay
How do I interpret level of significance?
Mohd Reply
It depends on your business problem or in Machine Learning you could use ROC- AUC cruve to decide the threshold value
Shivam
how skewness and kurtosis are used in statistics
Owen Reply
yes what is it
Taneeya
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Media processing in processing. OpenStax CNX. Nov 10, 2010 Download for free at http://cnx.org/content/col10268/1.14
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Media processing in processing' conversation and receive update notifications?

Ask