Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 25 Jun 2012
Offline Last Active Nov 22 2014 10:26 AM

Posts I've Made

In Topic: Best languages/tools for simple 3D graphics?

12 August 2014 - 04:43 AM

I find Ogre3D to be quite easy to use. It's for C++, but I believe they have a C# port.

In Topic: A ring of vertices perpendicular to a given direction

07 July 2013 - 09:51 AM

Aaargh... sleep.png typos... Always such errors when I'm doing maths... Why do other people always see such stuff so easily? Thanks.

In Topic: Does the projection of a point onto a plane belong to a triangle in that plan...

27 November 2012 - 11:45 AM

I took your second solution, it works excellently!

Here's the resulting code:
[source lang="cpp"]Ogre::Vector3 vectorOA = wallStrip[itr-2]; Ogre::Vector3 vectorOB = wallStrip[itr-1]; Ogre::Vector3 vectorOC = wallStrip[itr]; Ogre::Vector3 vectorAB(vectorOB - vectorOA); Ogre::Vector3 vectorBC(vectorOC - vectorOB); Ogre::Vector3 vectorCA(vectorOA - vectorOC); Ogre::Vector3 faceNormal = vectorAB.crossProduct(vectorCA) * (itr%2==0 ? 1.0 : -1.0); // It's a triangle strip if (vectorOA.dotProduct(faceNormal) > 0){ Ogre::Vector3 ABNormal = vectorAB.crossProduct(faceNormal); if (vectorOA.dotProduct(ABNormal) > 0) continue; Ogre::Vector3 BCNormal = vectorBC.crossProduct(faceNormal); if (vectorOB.dotProduct(BCNormal) > 0) continue; Ogre::Vector3 CANormal = vectorCA.crossProduct(faceNormal); if (vectorOA.dotProduct(CANormal) > 0) continue; // The projection falls within the triangle }[/source]

It also checks wether the point is on a specific side of the triangle, it's also inside a loop iterating through a vector of these triangles.
The point that I'm testing is actually the origin in this case, that's why you don't actually see it in the code.

It actually even worked the first time! (That was very unlikely, I'm a champion at typos Posted Image)

In Topic: Dividing large planets

25 June 2012 - 06:12 AM

An icosahedron is exactly what I need! Too bad there aren't any regular shapes that get closer to a sphere, but this one should work.