Java-Gaming.org Hi !
 Featured games (84) games approved by the League of Dukes Games in Showcase (575) Games in Android Showcase (154) games submitted by our members Games in WIP (624) 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 764 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.

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

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

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.

 ClaasJG (30 views) 2015-04-27 13:36:51 BurntPizza (34 views) 2015-04-23 03:42:11 theagentd (37 views) 2015-04-22 16:23:07 Riven (51 views) 2015-04-16 10:48:47 Duke0200 (60 views) 2015-04-16 01:59:01 Fairy Tailz (43 views) 2015-04-14 20:13:12 Riven (47 views) 2015-04-12 21:36:37 bus hotdog (65 views) 2015-04-10 02:39:32 CopyableCougar4 (67 views) 2015-04-10 00:51:04 BurntPizza (72 views) 2015-04-06 22:06:58
 theagentd 23x BurntPizza 17x wessles 15x Spasi 14x 65K 11x kingroka123 11x alwex 11x Rayvolution 7x Hanksha 7x Riven 7x chrislo27 7x kevglass 7x Olo 7x Ecumene 7x ra4king 7x KevinWorkman 6x
 How to: JGO Wikiby Mac702015-02-17 20:56:162D Dynamic Lighting2015-01-01 20:25:42How do I start Java Game Development?by gouessej2014-12-27 19:41:21Resources for WIP gamesby kpars2014-12-18 10:26:14Understanding relations between setOrigin, setScale and setPosition in libGdx2014-10-09 22:35:00Definite guide to supporting multiple device resolutions on Android (2014)2014-10-02 22:36:02List of Learning Resources2014-08-16 10:40:00List of Learning Resources2014-08-05 19:33:27
 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