View Full Version : Slicing 3D Model
12-03-2007, 11:59 PM
I am very new to 3D modeling and OpenGL, Actually just looking arround to find out if OpenGL would solve my problem, I am wondering if OpenGL helps to extract 2D slice data (2D image x,y coordinates) from a 3D computer graphical model, originally the 3D model is imported from a standard file format like 3DS, so in any case I need a plugin which helps importing such file and convert it to OpenGL data srtucture,
Most importantly, does OpenGL data structure encapsulate x,y,z coordinates, is it possible to extract x,y values at certain cut offs of z for example,
If not do you suggest any other tools in C++ which helps to achieve that,
12-04-2007, 10:59 AM
Looks like you're not looking for an API (like OpenGL) - you're looking for an algorithm.
You can do it in different ways:
1. Implement on CPU
You don't use OpenGL nor any other library here.
2. Using OpenGL's feedback mode
I do not recommend it - #1 is easier to implement and will work faster.
3. Using modern GPU's features with OpenGL
Recommended for advanced programmers. This is more less #1, but implemented on GPU instead of CPU. Will work very fast.
So, I guess you're interested in #1. It's pretty simple.
For every polygon in the original 3D model you have 3 possible cases:
1. polygon is entirely in front of slice plane - ignore this polygon
2. polygon is entirely behind slice plane - ignore this polygon
3. polygon is partially in front of slice plane
In case #3 you look at polygon's edges:
1. edge is entirely in front of slice plane - ignore this edge
2. edge is entirely behind slice plane - ignore this edge
3. edge crosses the slice plane - find exact point of collision
You should find 2 points for each polygon. These 2 points define an edge of your 2D model.
12-06-2007, 07:10 AM
How about dividing 3D Model using a uniform 3D grid (each grid element stored similar to a voxel).and then compute the intersection. Intersected points in one iterations can be taken as a slice.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.