Re: Problem with displaying the line segments
Posted by world on Apr 27, 2017; 9:47pm
URL: https://forum.jogamp.org/Problem-with-displaying-the-line-segments-tp4037890p4037904.html
I suppose the 'system' (low-level library) knows nothing about cube's center.
Explanation: what if we have non-convex or non-simplyconnected objects?
Such objects can have complex intersections an even self-intersections.
So, the only way for the 'system' to display correctly everything - is:
1) Consider the whole set of all elementary elements (segments, triangles),
2) Find intersections of all pairs of elements,
3) Split elements with intersection lines or points (if have) and construct new list, that have no intersections,
4) Order new list in Z-direction, where Z-axis - is normal to the screen expressed in virtual coordinates,
5) Draw new ordered list.
Then invisible parts will be automatically removed from the target projection of 3D scene on the screen.
Transparent elements will be also displayed correctly, because we take into account both background color
and color of elements that have been already drawn at this place.
---
To decide which way of displaying is correct, to avoid subjective judgments,
we can imagine the corresponding physical construction:
two cubes made of green and blue transparent glass, one inside another;
each cube has thin white (non-transparent) tubes along the edges.
What we can see then? The answer: white frame will be visible in any case with some features:
1) segments of lines visible through the green surface will be green,
2) segments of lines visible through the green and blue surfaces will be of some dark color.
Conclusion:
1) Non of considered variants gives expected picture,
Most close to correct - BasicBox2.java (see above) and BasicBox4.java (see above),
2) Even good pictures are unstable, depends on initial scene location.