|
|
Am 04.08.2016 um 17:44 schrieb And:
> Why?
> here is a union version. It's ok.
Union is special among the CSG operations in that it works fine with
non-solid objects. All other CSG operations need solid objects to work
properly.
To POV-Ray, "solid" means that there is a method to test whether any
given point is inside or outside a shape. The normal ray tracing
algorithm does not need such a test, since the only thing it cares about
is surfaces. Likewise, unions do not need such a test, since they do not
change what surfaces are rendered. Merge, difference, intersection and
clipped_by, on the other hand, work by selectively suppressing portions
of an object's surface depending on which other objects they're inside
-- and that's where the insideness test is crucial.
For meshes, the insideness test is implemented by tracing a ray from the
point in question in an arbitrary direction, and counting how many times
that ray intersects the object's surface. An odd number of intersections
indicates that the point in question is inside, while an even number
indicates that it is outside. For this algorithm to work properly, two
conditions must be met:
- The mesh must be properly closed (i.e. each and every triangle must
precisely share each of its edges with an odd number of other triangles).
- The "arbitrary direction" needs to be chosen. This is not done
automatically, but instead requires the use of the `inside_vector`
keyword, with a non-zero vector. (The actual direction does not normally
matter; however, if the vector happens to be almost but not quite
parallel to one of the triangles, there is a slight chance that
artifacts may occur, especially if that triangle is particularly large.)
Post a reply to this message
|
|