QGLWidget - Cross section of 3-D hollow objects
Asked Answered
H

2

5

I'm using QGLWidget to draw 3-D objects, the input to my program is the faces of the shapes.

Meaning that when I want to draw a cube, I got list of 6 elements each one represent a face and each face contain 4 points, (x,y,z) for each point.

The drawing is done, but I'm trying to implement a cross section feature, so far the result shape after the cross section is a hollow objects, How Can I get the cross section results as if the shapes were not hollowed?

Halfbaked answered 23/10, 2013 at 12:7 Comment(1)
so you want to clip part of the object and fill the inside void with a faceVisakhapatnam
P
9

OpenGL doesn't know "objects". It doesn't know "solid" or "hollow". All OpenGL knows are points, lines and triangles. If you want to make your object appear solid, you'll have to calculate the geometry of the cut-away object, resulting in a new mesh, which you use as input data for drawing.

The cut-away process is part of a set of operations known as "boolean geometric operations" also coined "constructive solid geometry". If you Google for that, you'll find plenty of information.

Piloting answered 23/10, 2013 at 14:28 Comment(0)
O
2

I believe what you are trying to achieve is some boolean operation on 2 geometry objects. For this purpose there is a perfect geometry library in Boost, and you need one of this algorithms: diff or intersection. Given the examples, it's easy to modify them for your specific object structure.

Overbite answered 8/11, 2013 at 5:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.