If I am given the exact coordinates of three vertices in image-space (as in, the numbers are not integers, but can be rounded to find their location on the screen), how can I determine which pixels are inside the triangle and should be colored? If you look at the diagram below it might clarify what I'm trying to do http://oi47.tinypic.com/eaktwi.jpg As you can see, the pixels which are mostly within the triangle are filled green. How can I do this in code?
|+0 forum 4|
I'm using Swing's GeneralPath to create complex shapes and fill them. Usually I do this, and it creates a nice hexagon for me: [CODE] path.moveTo(100, 100); path.lineTo(150, 100); path.lineTo(180, 150); path.lineTo(150, 200); path.lineTo(100, 200); path.lineTo(70, 150); path.lineTo(100, 100); g2.draw(path);[/CODE] Suppose I wanted to create a donut-shaped GeneralPath, and do this: [CODE] path.moveTo(100, 100); path.lineTo(150, 100); path.lineTo(180, 150); path.lineTo(150, 200); path.lineTo(100, 200); path.lineTo(70, 150); path.lineTo(100, 100); path.moveTo(110, 110); path.lineTo(125, 120); path.lineTo(110, 120); path.lineTo(110, 110); path.closePath();[/CODE] Draw this and you'll get the same hexagon with a closed triangle in the middle (a pretty bad donut, yeah). That's all fine, but when I …
|+0 forum 1|
hi, actually i wanted to draw two cubes programmatically in C# with only top,front and right portions visible.the top and right portion will have the same dimensions but depending on the parameter width provided by the user,the front portion will increase along the horizontal axis.One cube will increase along the positive x axis and other one will increase towards the negative x axis i.e one will progress towards the left side and other will progress towards the right side. Can you please provide the C# code for this asap.Thanks in advance
|-1 forum 21|