• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Archived

This topic is now archived and is closed to further replies.

v71

triangle

11 posts in this topic

The winding number is a 2D beasty, and to find it you have to project the triangle and point of interest into a plane. For example, a 3D point may be inside or outside a 3D triangle depending on from where you look.

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
0

Share this post


Link to post
Share on other sites
I''m not taking about a 3d test point i want to know if a triangle is clockwise or counterclockwise given 3 triples in space

0

Share this post


Link to post
Share on other sites
Okay,

Still depends on where you''re looking from. Any triangle will appear to be clockwise from one side, counterclockwise from the other.

Lets look at how the normal of a triangle is calculated. The triangle has points 1, 2, and 3. You can find a normal by crossing the vector from 1-2 with the vector from 1-3. If you do this, then the normal will point to the side of the triangle that makes it appear counterclockwise. That is, if you look towards the triangle from the side the normal points to, the triangle will look counterclockwise. If you look from the other side, the triangle will be clockwise.

Choose a look-at direction. This is a vector from, say, a camera, to one of the triangle vertices. Dot this look-at vector with the normal calculated above. If the dot product is negative, the triangle is counterclockwise from your pointer of view. It the dot product is positive, the triangle is clockwise from your point of view.

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
0

Share this post


Link to post
Share on other sites
Ok, i''ll go deep in that , i have some 3ds file that are double faced that''s to say some traingles have the winding reversed
when i import them, i have to find a way to see if some
triangle is facing right if not , reverse the triangle indicies .
that''s why i need to know if a triangle is counterclockwise or not.

0

Share this post


Link to post
Share on other sites
That''s a bad situation, since you can''t pick a single viewpoint that''ll work for all triangles. If the geometry is fairly simple, you might try the centroid of the object.
0

Share this post


Link to post
Share on other sites
One method I just thought of:

Pick (and tag) a single triangle that is facing the correct direction. Then find other triangles that share a side with that one and are facing the same way (they should have two and only two same vertex values, but in the opposite order). Tag those as well. Recursively continue in this manner, tagging as you go, until all faces in a specific direction are tagged (no more valid boundaries). then delete untagged triangles. this should work well for well-behaved geometry.
0

Share this post


Link to post
Share on other sites
Once again, pardon my horrendous ASCII art...

        
1 ________H
/\ / \ / \2 / \\ 3
----------


So you've got a triangle. Pick the first vertex, any vertex. (Assume my first top one.) Create a fictious horizontal line from that vertex.

Take the second vertex of the triangle and compute the angle between the horizontal line and the segment between the first and second vertexes. Make it such that the angle is between 0° and 360°. Do the same for the third vertex.

If <H12 is less that <H13 (as mine is above), it is counterclockwise. If <H12 is greater that <H13, then clockwise.

~ Dragonus

Edited by - Dragonus on August 21, 2001 3:04:47 PM
0

Share this post


Link to post
Share on other sites
Yes, i have already tried with the centroid ( placed at 0,0,0 )
but this works for convex and enclose geometry a cube or a sphere
i think this isn''t a np-complete problem.
i have tried also with the direction of the normal , but
towards which viewer ? then projecting the triangle oacross
the 3 planes and finding the signed are for each plane
using a bitmask to see if all of them contain the same singed area but this is not working....

0

Share this post


Link to post
Share on other sites
Ignore my ascii art above. Doesn''t like it when I edit the message... Here''s the real deal...

        
1 ________H
/\
/ \
/ \
2 / \ 3
----------
0

Share this post


Link to post
Share on other sites
I like Sneftel''s approach, and it should work well as long as your model is relatively smooth and if you deal with each separate mesh object individually.

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
0

Share this post


Link to post
Share on other sites
The only problem is drawing a line passing from a point which
has the components normal to the surface normal
that''s to say a*l+b*m+c*n = 0 and this is not an easy task
it works if the triangle is aligned with some axis


0

Share this post


Link to post
Share on other sites