Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (109)
games submitted by our members
Games in WIP (536)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  How do i generate triangles from points on a plane? (in 3D)  (Read 589 times)
0 Members and 1 Guest are viewing this topic.
Offline Longor1996
« Posted 2013-05-14 16: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.

Please help!

- 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.
Offline Roquen
« Reply #1 - Posted 2013-05-14 17: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.
Offline Longor1996
« Reply #2 - Posted 2013-05-14 17: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.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Roquen
« Reply #3 - Posted 2013-05-14 17: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".
Offline Longor1996
« Reply #4 - Posted 2013-05-14 17: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.

Thank's for the advice.

- Longor1996

Sorry for my bad English! That's because i am from Germany.
Offline Roquen
« Reply #5 - Posted 2013-05-14 19: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.
Online relminator
« Reply #6 - Posted 2013-05-15 02: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.

CogWheelz (15 views)
2014-08-01 22:53:16

CogWheelz (15 views)
2014-08-01 22:51:43

CopyableCougar4 (16 views)
2014-08-01 19:37:19

CogWheelz (19 views)
2014-07-30 21:08:39

Riven (27 views)
2014-07-29 18:09:19

Riven (16 views)
2014-07-29 18:08:52

Dwinin (14 views)
2014-07-29 10:59:34

E.R. Fleming (35 views)
2014-07-29 03:07:13

E.R. Fleming (13 views)
2014-07-29 03:06:25

pw (44 views)
2014-07-24 01:59:36
Resources for WIP games
by CogWheelz
2014-08-01 18:20:17

Resources for WIP games
by CogWheelz
2014-08-01 18:19:50

List of Learning Resources
by SilverTiger
2014-07-31 18:29:50

List of Learning Resources
by SilverTiger
2014-07-31 18:26:06

List of Learning Resources
by SilverTiger
2014-07-31 13:54:12

HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22
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
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!