Jump to content

  • Log In with Google      Sign In   
  • Create Account


CaptainMurphy

Member Since 25 Mar 2009
Offline Last Active Aug 16 2014 12:31 AM

Posts I've Made

In Topic: Font Rendering

15 August 2014 - 01:38 PM

This library really needs some kind of docs or at least example code, I wasn't able to figure it out.


In Topic: Calculate if angle between two triangles connected by edge

10 July 2014 - 11:07 PM

Thanks, I'll give it a try when I get time.


In Topic: Calculate if angle between two triangles connected by edge

10 July 2014 - 03:28 AM

Okay, after Álvaro's question I realised I was confusing the problem. for two triangles sharing an edge I want to find out whether they are facing away from each other, facing towards each other or laying flat (same normal).

 

So a slight change from  C0lumbo's method, I dot product the normal from the first triangle to the non shared edge of the second triangle, where dotproduct=0 is both triangles laying flat, dotproduct<0 facing away (convex), dotproduct>0 facing towards (concave).

 

Seems like it should work.


In Topic: Calculate if angle between two triangles connected by edge

10 July 2014 - 01:27 AM

 

The limitation of using the dot product is that you can't work out the direction of the fold. 90 degrees either way looks the same. The trick would be to use some other technique to work out the fold direction. I can't think of a particularly elegant way to calculate the direction: One idea is to take the normal of your first triangle and dot product it with one of the edge directions from your second triangle (just not the shared edge!). The result will be a positive or negative number depending on which direction the fold is.

 

 

Yes this was the problem I ran into, I'll give your suggestion a try.

 

What's an example where the angle is more than PI?

 

 

The triangles are part of a 3D mesh, so I'm trying to tell if they are concave or convex, so >= PI is convex and < PI is concave.

 

The vertices are winded clockwise so the triangle normals always on the outer surface of the mesh.

 

EDIT:

 

Ah I just realised what you meant, I've been looking at the problem a bit wrong. I'll have think about this a bit more and get back to you.


In Topic: How can I use multiple shaders in one mesh?

21 December 2012 - 01:40 AM

If you mean to combine the results of multiple shader programs into one, I think you will have to render the mesh to a texture with each shader program, and then blend the results together (probably using another shader program).


PARTNERS