Java-Gaming.org
 Featured games (81) games approved by the League of Dukes Games in Showcase (497) Games in Android Showcase (114) games submitted by our members Games in WIP (563) games currently in development
 News: Read the Java Gaming Resources, or peek at the official Java tutorials
Pages: [1]
 ignore  |  Print
 How do i generate triangles from points on a plane? (in 3D)  (Read 618 times) 0 Members and 1 Guest are viewing this topic.
Longor1996
 « Posted 2013-05-14 14:31:42 »

Hello everyone!

I have a question, for that i can't seem to find a good answer for on Google.

The question is this:
I have a plane in 3-dimensional space, that is stored as a object containing a plane-equation,position and a surface-Normal.
And I have a set of n 3D-points, that all are lying on the plane.

 1  2  3  4  5  6  7 `// Probably important: Im using Vector's as Point's and vice-versa.class Vector{ float x,y,z;  -snippedTheRestOfTheClass-}`

 1  2  3  4  5  6  7  8 `class Plane{ float d; Vector position; Vector normal;  -snippedTheRestOfTheClass-}`

Now i wan't to generate Triangle's from these points-on-the-plane.
Im somewhat unable to successfully implement a algorythm that does that for me.
My math-teacher told me I should try to '2D-project' the point's onto the plane and connect them then using 2D logic.
Too bad I don't know how to do this right.

- Longor1996

PS: Im (still) sick, so please write in a way that i don't have problems to understand the things you write.
PPS: Also, i wan't to generate as few triangle's as possible, if that is possible.
PPPS: The generation of these triangle's is for 'offline'-use, so it doesn't have to be fast.

Sorry for my bad English! That's because i am from Germany.
Roquen
 « Reply #1 - Posted 2013-05-14 15:20:19 »

You're teacher's correct, since all the points are on a plane it's a 2D problem.  But to get an answer to your question you'll have to provide more details.  Like what are you attempting to do.

EDIT: Well, assuming that there's an outer perimeter of whatever it is you're doing, then you need to find the convex hull...well assuming you want convex containment.
Longor1996
 « Reply #2 - Posted 2013-05-14 15:31:15 »

You're teacher's correct, since all the points are on a plane it's a 2D problem.  But to get an answer to your question you'll have to provide more details.  Like what are you attempting to do.

Okay, how does one project points onto a plane and then connect them to make triangle's?
Maybe I have luck searching for "project points onto plane and connect hem to triangle's".
And I already said what I wan't to do, if you wan't to know for what exactly:
It's for a CSG-Raytracer based on triangle-meshe's. I already know how to do everything, the only missing part is the triangle generation.
And don't tell me that I can raytrace CSG-body's directly, i already know that.
It's just that I would like to use the triangle-generator for some other thing's later too.

- Longor1996

Sorry for my bad English! That's because i am from Germany.
Roquen
 « Reply #3 - Posted 2013-05-14 15:43:44 »

We're already having a communication problem:  You say that all the point are on a plane.  If that is the case there's no projection needed.

search: "mesh from point cloud".
Longor1996
 « Reply #4 - Posted 2013-05-14 15:50:05 »

We're already having a communication problem:  You say that all the point are on a plane.  If that is the case there's no projection needed.

search: "mesh from point cloud".

Okay, I found something called "Delaunay triangulation", wich seems like the best solution to my problem.
Actually, not all point's are on the plane, but these non-plane point's are getting sorted out by a very simple point-on-plane test before they are put into the trinalge generator.

- Longor1996

Sorry for my bad English! That's because i am from Germany.
Roquen
 « Reply #5 - Posted 2013-05-14 17:58:39 »

In that case: I'm pretty sure that there is a java version of qhull which probably has the code that you need.
relminator
 « Reply #6 - Posted 2013-05-15 00:35:50 »

Delaunay's is a pretty good algo.  There are other algos you might want to try like seidels to generate voronoi diagrams.

If you just want a convex hull, I used grahams.

I have some code here but google would probably give you better examples in java since mine is in another language.
Pages: [1]
 ignore  |  Print

You cannot reply to this message, because it is very, very old.

 Add your game by posting it in the WIP section, or publish it in Showcase. The first screenshot will be displayed as a thumbnail.
 UprightPath (20 views) 2014-09-20 20:14:06 BurntPizza (26 views) 2014-09-19 03:14:18 Dwinin (40 views) 2014-09-12 09:08:26 Norakomi (70 views) 2014-09-10 13:57:51 TehJavaDev (95 views) 2014-09-10 06:39:09 Tekkerue (49 views) 2014-09-09 02:24:56 mitcheeb (70 views) 2014-09-08 06:06:29 BurntPizza (52 views) 2014-09-07 01:13:42 Longarmx (39 views) 2014-09-07 01:12:14 Longarmx (45 views) 2014-09-07 01:11:22
 BurntPizza 36x Riven 18x Rayvolution 18x ags1 16x princec 16x basil_ 16x KevinWorkman 15x LiquidNitrogen 12x theagentd 11x kevglass 11x deathpat 11x nsigma 11x HeroesGraveDev 8x TehJavaDev 6x PandaMoniumHUN 6x Gibbo3771 6x
 List of Learning Resources2014-08-16 10:40:00List of Learning Resources2014-08-05 19:33:27Resources for WIP games2014-08-01 16:20:17Resources for WIP games2014-08-01 16:19:50List of Learning Resources2014-07-31 16:29:50List of Learning Resources2014-07-31 16:26:06List of Learning Resources2014-07-31 11:54:12HotSpot Optionsby dleskov2014-07-08 01:59:08
 java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org