Java-Gaming.org Hi !
 Featured games (90) games approved by the League of Dukes Games in Showcase (788) Games in Android Showcase (234) games submitted by our members Games in WIP (862) 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 2048 times) 0 Members and 1 Guest are viewing this topic.
Longor1996

JGO Wizard

Medals: 116
Projects: 2
Exp: 8 years

The cake is probably a lie.

 « 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.

The cake is probably a lie... but it's a delicious lie!
Roquen

JGO Kernel

Medals: 518

 « 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

JGO Wizard

Medals: 116
Projects: 2
Exp: 8 years

The cake is probably a lie.

 « 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

The cake is probably a lie... but it's a delicious lie!
Roquen

JGO Kernel

Medals: 518

 « 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

JGO Wizard

Medals: 116
Projects: 2
Exp: 8 years

The cake is probably a lie.

 « 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

The cake is probably a lie... but it's a delicious lie!
Roquen

JGO Kernel

Medals: 518

 « 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

 hadezbladez (2132 views) 2018-11-16 13:46:03 hadezbladez (811 views) 2018-11-16 13:41:33 hadezbladez (2105 views) 2018-11-16 13:35:35 hadezbladez (420 views) 2018-11-16 13:32:03 EgonOlsen (3454 views) 2018-06-10 19:43:48 EgonOlsen (3681 views) 2018-06-10 19:43:44 EgonOlsen (2275 views) 2018-06-10 19:43:20 DesertCoockie (3004 views) 2018-05-13 18:23:11 nelsongames (3084 views) 2018-04-24 18:15:36 nelsongames (3853 views) 2018-04-24 18:14:32
 Deployment and Packagingby philfrei2019-02-17 20:25:53Deployment and Packagingby mudlee2018-08-22 18:09:50Java Gaming Resourcesby gouessej2018-08-22 08:19:41Deployment and Packagingby gouessej2018-08-22 08:04:08Deployment and Packagingby gouessej2018-08-22 08:03:45Deployment and Packagingby philfrei2018-08-20 02:33:38Deployment and Packagingby philfrei2018-08-20 02:29:55Deployment and Packagingby philfrei2018-08-19 23:56:20
 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