Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in D:\Websites\rave.ca\website\include\functions\visitors.php on line 5

Warning: Cannot modify header information - headers already sent by (output started at D:\Websites\rave.ca\website\include\functions\visitors.php:5) in D:\Websites\rave.ca\website\index.php on line 546

Warning: Cannot modify header information - headers already sent by (output started at D:\Websites\rave.ca\website\include\functions\visitors.php:5) in D:\Websites\rave.ca\website\index.php on line 547

Warning: Cannot modify header information - headers already sent by (output started at D:\Websites\rave.ca\website\include\functions\visitors.php:5) in D:\Websites\rave.ca\website\index.php on line 548
Journals - 8pstarg - Rave.ca
Rave Radio: Offline (0/0)
Email: Password:
New Account
Forgot Password
2008 December:
[ ]Massively interesting
[ ]Mon chemin (parce qu'il faudrait bien que j'y mette un titre...)
[ ]MOi!!!
[ ]Fake plastic masks
[ ]Alchimie
[ ]Un. Trou. Noir.
[ ]Brumes
[ ]DJ IN THE BOX! PODCAST 05 (Tom Colontonio anthem)
[ ]we talk too much
[ ]Reign In Blood!!!!
[ ]Self Aware
[ ]Mainframe
[ ]Damn shitty.
[ ]New Mix! Chimichanga 2
[ ]all i need
2008 November:
[ ]La fin!
[ ]OTHER SIDE (Original mix) - DJ IN THE BOX!
[ ]Impulsif?
[ ]À l'amour!
[ ]Saphir pour Hardcore Underground
[ ]Demenagement et recherche Coloc
[ ]fds et le reste
[ ]WoW is just scientology with elves
[ ]le style de ljho,,e de ljp,,e libre
[ ]Muzik 4 Machines
[ ]Incapable de lire ma musique?
[ ]La déchéance de ma meilleure amie
[ ]NEW release on myspace
2008 October:
[ ]Un album?
[ ]getting really sick of these dreams...
[ ]Dj In The Box! PODCAST 02
[ ]sujets
[ ]Dj In The Box! on RadioFree USA
[ ]Signification de rêve
[ ]Another WTF dream that goes into a sleep paralysis
[ ]Maudite Bronchite
[ ].
[ ]Dj In The Box! PODCAST
[ ]RIPFeuMAth
[ ]between & et & :-
[ ]Ice Age
[ ]8pstarg
[ ]First Journal
[ ]I love this city
2008 September:
[ ]the underground
[ ]Journal de voyage d'une Fée
[ ]un veritable ami
[ ]house of cart
2008 August:
[ ]Big Changes
[ ]Bizarre
[ ]Mayan Astrology
[ ]The self
[ ]Call of the Eldest
[ ]seul..
2008 July:
[ ]Art Proposal (Monks With Sticks/Sex, Lies, And Videotape)
[ ]To
[ ]She's A Killer Queen
[ ]psychedelic experience
[ ]Sa vous interesseras peut-être pas mais ...
[ ]Provocation....et merci.
[ ]I like Monkeys
[ ]Downfall.
[ ]booker , manager wanted !!!
[ ]???
2008 June:
[ ]Nite-lite was kick ass! and Tiesto soon + more!
[ ]Les temps changent... les gens...
[ ]StReSsEd!!!!
[ ]Value.
[ ]Bored:Saturday,June 14th,2008
[ ]Midnight Random Thoughts
2008 May:
[ ]Breaking Me Up
[ ]www.SCHiZO.etsy.com
[ ]Anime list of sorts
[ ]My place in the smallest of spotlights among those who shine et ainsi de suite ^^
[ ]Wow, Just ... Wow
[ ]Remember to Forget
[ ]http://www.1000ventures.com
[ ]Killing time.
[ ]Sketchy Randomness
[ ]Burial - Archangel
[ ]A Raver's Manifesto
[ ]This is my manifesto.
[ ]Dance Hall Queen~Routine...
[ ]Hope
2008 April:
[ ]Credit recovry
[ ]Well THAT was fucking close
[ ]Kuujjuaq
[ ]Psyilence prejudice
[ ]Travelling...
[ ]confortably numb
[ ]fist rave
[ ]Apology
[ ]Lonely is better right now.
[ ]Expressions
[ ]memo
[ ]Montreal Morning--- The story of me
[ ]Whats new?
[ ]Incomprehendiular
[ ]Didier Super - Petit Caniche
[ ]Growing up
[ ]Nous sommes?
2008 March:
[ ]I like Monkeys
[ ]fucking stalkers
[ ]Transitions
[ ]vampiros venezolanos
[ ]j'aime faire des croquettes au chien
[ ]Genesis - Dancing with the Moonlit Knight
[ ]Genesis - The Musical Box
[ ]Genesis - Supper's Ready
[ ]Des quotes Rave.ca 2008
[ ]Thom Yorke - Skip Divided
[ ]what a weekend!!
[ ]New Here
[ ]Once I lost a smile
[ ]espoir
[ ]J'aime mieux...
[ ]Ezechiel 25:17 i!
[ ]Apocalypticodramatic
[ ]"Why do they call you Butterman?"
[ ]Why do I get all the love in the world...
[ ]good things come to those who wait
[ ]4 mars 2008
[ ]Le Grand Sommeil
[ ]last night was tits!
2008 February:
[ ]Quelques mots de Jardin
[ ]Inconscience
[ ]Éveil...
[ ]Il faudrait apprendre à lire
[ ]no dnb last night
[ ]Tonight
[ ]Duopolis...
[ ]I live in Montreal
[ ]of silence
[ ]Night at cody's/ update
[ ]Free LInks (YouTube) to Noise(music)
[ ]Butterman's all-time (L8T 90s, Y2K, post) favorite adult film female stars/performers
[ ]One of those defining moments
[ ]um...I was told to start a journal
[ ]A Journal Not for Party
[ ]I am in "LOVE" with Hollywwod actress Christina Ricci.
2008 January:
[ ]Paroles en l'air
[ ]Mon entrée
[ ]In the End...
[ ]a semi-rant
[ ]be a space pirate prt.2
[ ]stuff from my personal journal
[ ]Ravers are depraved. (???!!!!!!!!!!!!!)
[ ]PLUR, what?
[ ]The New Rave and our trip to montreal
[ ]NEW RAVE!, New Friends...and a Sadly Early Departure REVISED
[ ]Vida de la musika
[ ]New Rave! The Prequel!!
[ ]Value Village is Awesome!!!
Posted On:2008-10-10 18:28:22
Posted By:» BonneNuit
With two-dimensional graphics, it's usually fairly easy to specify the coordinates that govern the location and size of a graphical figure. With 3D graphics, you might not have this convenience: Often you're working with primitives that have a fixed location and size, and you must use transforms to move and resize the figures.

In Chapter 2 of my new book 3D Programming for Windows I show how to use TranslateTransform3D and ScaleTransform3D to assemble simple figures from unit cubes. (A unit cube has a width, height, and depth of 1 unit and is centered on the origin of the 3D coordinate system.) In Chapter 3 I continue those demonstrations with rotation, and Chapter 7 has some more advanced math behind deriving complex rotations in 3D space.

I'd like to show another demonstration here using unit cubes to construct a fairly simple figure (a 7-pointed star) in 3D space. Fortunately all the trigonometry involved will be in two dimensions on the XY plane.

Here's a seven-pointed star with a radius of 1 centered on the origin of a conventional 2D Cartesian coordinate system. Each point of the start is associated with an angle measured counter-clockwise from the positive X axis:

I started with 90° at the top and then just incremented by 51-3/7° (360 ÷ 7) going counter-clockwise. Each of the points of the star is also associated with a coordinate point whose X value is the cosine of the angle and whose Y value is the sine:

The seven lines that form the star are the same lengths, which can be calculated using the Pythagorean theorem. Here's the calculation of the length of the line from the upper-right of the star to the bottom-left.

((–0.434 – 0.782)2 + (–0.901 – 0.623)2)0.5 = 1.950
I'm going to build the seven-pointed star from unit cubes, and the first step is to turn a unit cube into a "plank" that is 1.95 units long, (let's say) 1 unit deep, and (let's say also) 0.05 units thick. Here's the XAML file that performs this very first step:


The unit cube is defined as a resource, and a GeometryModel3D based on this cube is also defined as a resource. This GeometryModel3D resource has a ScaleTransform3D applied with a ScaleX factor of 1.95 and a ScaleY of 0.05. The resource is named "plank" and Step 1 creates just one ModelVisual3D based on this resource. The figure is still centered on the origin:

The objective now is to create seven figures based on this resource, and apply translation and rotation transforms to them so they form the seven legs of the star. By default, rotations occur around the origin, so in this case it's easier to rotate the plank first and then translate it to its proper location. As an example, let's look at the leg from the upper-right point (0.782, 0.623) to the lower-left point (–0.434, –0.901). The angle this leg makes with the X axis can be calculated as the inverse tangent of the ratio of the difference between the Y and X coordinates:

tan-1((0.623 + 0.901) / (0.782 + 0.434)) = tan-1(1.524 / 1.216) = 51.4°
The center of the plank at the origin must be translated to the mid-point of that leg, which is the average of the points at the ends, or:

((0.782 – 0.434) / 2, (0.623 – 0.901) / 2) = (0.174, –0.139)
The plank can thus be positioned with an AxisAngleRotation3D element with an Axis property of (0, 0, 1) and an Angle of 51.4, followed by a TranslateTransform3D with OffsetX and OffsetY properties of 0.174 and –0.139, respectively.

Continue with the other legs. Of course, you can take advantage of symmetry to reduce the calculations. Here's the resultant XAML file:


And it looks like this:

Of course, once you have a figure like this completed, it's always fun to animate it, if only to verify that the sides actually change shade as they make different angles with the light source. Here's a version that rotates the star around the Z axis:


And then I thought: Wouldn't it be fun to animate the seven planks so they started in a kind of stack and then moved to their proper positions in the star? Each of the TranslateTransform3D and AxisAngleRotation3D elements would need to have x:Name attributes, and I'd need another 13 DoubleAnimation elements. (It's not 14 because one of the legs has no rotation.) But the animations would be fairly simple because they'd have only simple From attributes and no To attributes. So here it is:


Buy my book and we'll both be happy!
Amazon.com BookSense.com quantumbooks
Barnes & Noble Amazon Canada Amazon UK
Amazon Français Amazon Deutsch Amazon Japan



I really like your .NET books! You're my hero!

— Boris, Thu, 30 Aug 2007 15:44:28 -0400 (EDT)

i have this star tattooed on the back of my neck

— amanda, Sun, 17 Feb 2008 17:47:33 -0500 (EST)

Submit comment:


URL or Email (optional):

Comment (no HTML please):

NOTE: Comments are examined personally and generally posted within 12 hours.

Recent Entries
< Previous Browse the Archives Next >
Subscribe to the RSS Feed


(c) Copyright Charles Petzold