Good evening, fellow DevMasters!
I come to you with an unusual requirement. I am looking for an algorithm
(preferably implemented somewhere) which renders coinciding line
segments using the same pixels in the region they coincide. The
following screenshot illustrates the problem:
I need the blue and the black lines to be rendered using the same
pixels, because they are also coinciding segments. Thanks for any
Please log in or register to post a reply.
I’d scan your wireframe database for coincident lines and then, removing
one of the offending line.
Note that this kind of problems are infested with numerical precision,
normally you’d use an epsilon to discriminate between near collisions.
I have a function in c++ detecting if two lines are intersecting,
separated, or coincident, if you need it let me know.
Hey v71, that isn’t exactly the issue. Thanks for the reply! I know
beforehand they are coincident, this is 100% certain so no need to
check. However as you can see in the image, the rendering algorithm
doesn’t use the same pixel set in the common region which is my problem.
I settled down for the “diamond exit” algorithm which deals with that
nicely, but I had to implement it myself.
In case someone is interested in the issue, I implemented a diamond exit rasterizer for aliased lines in Java based on the OpenGL / Direct3D specifications with line stippling based on OGL. It works fine for my project, but it’s not very optimized.