![]() The point lies on the inside and we fill the "hole" with color. The next crossing also goes from left-to-right, we again subtract one. The first crossing of the blue ray goes from left-to-right, we subtract one. While the red and black rays yield the same result, the blue ray gives us something very different. Things are a little different for the general shape seen below. We see that for the circle, square, and triangle, the results are the same for the even-odd rule. The sum of our path crossings is zero and we conclude, like in the case of the even-odd rule, the point lies on the outside. As we continue our ray, the next crossing runs from right-to-left and we add one. We do the same thing with the Even-Odd Parity Rule with one exception-if the path runs counter-clockwise as we cross it, we add one and subtract one if it runs clockwise.įor the circle, the first path crossing runs from left-to-right so we subtract one. We use our rays to determine whether a point lies on the inside or outside of a shape. We see that the blue ray crosses the shape's path two times, an even number of times, which means the point lies on the outside of the shape and we don't color this area. There is some doubt whether that point lies on the inside or outside of this shape but we can apply the even-odd rule. Now let's look at the blue ray as it goes out from the hole. When we look at the red ray we see it crosses the shape's path once and we conclude that point lies on the inside. This point lies on the outside of the shape. This makes the sum of path crossings odd and we conclude that the point lies on the inside of the shape.īut what happens with the general polygon below? We see that the black ray crosses the general polygon's path four times-an odd sum. After that your code should work just fine. We see that they all cross the shape's path once. You need to use the shapes.geometric library in order to use the regular polygon shape. ![]() Now we construct some rays (shown in red) that lie on the inside. This sum is even and we can conclude that the point lies on the outside of those shapes. For the circle, square, and triangle, the ray crosses the shape's path twice. Filling shapes with color is a fairly easy process but it becomes more difficult depending on the complexity of the shape. We construct rays, both inside and outside, going through our shape of interest to determine if a point lies on the inside or ourside.įor a standard polygon, the shapes shown on top, it is easy to see where the outside lies but let's construct a few rays (shown in black) that lie outside and see what we get. in the previous example), whereas to create a regular polygon, besides center (. We will see how both rules differ and why. The parameters defining the base shape are explained in the geometric. If the total winding number is zero then our point lies on the outside but if the winding number is not zero then the point lies on the inside. If the path is counter-clockwise, or runs from right to left, we add one to the score. If the path is clockwise, or runs left to right, we subtract 1 from the score. The number of intersections is scored and given a winding number. ![]() Unlike the even-odd rule, the non-zero winding rule relies on knowing the stroke direction for each part the ray crosses. If it is even then it lies on the outside. ![]() If the number is odd then the point lies on the inside of shape. With the even-odd rule, we count the number of times the ray crosses a path segment. To determine the "insideness" of a point, we draw a ray from the point we wish to determine to infinity in any direction. There are two rules we can use to fill fhapes in Ti kZ:īoth rules are algorithms that are used to determine whether a given point falls within an enclosed curve. ![]() Their paths do not intersect and the shape does not have a hole unlike the general polygon below. Uncomment the line % xscale=1.5 (and used the desired factor) if you want to elongate the hexagons along the x-component.The circle, square and triangle are basic polygons. The two colors are controlled by lightfill and darkfill using 0 fills the hexagon with just darkfill and using 1 fills it completely using lightfill. allows to specify the fraction of the hexagon that will be filled with the second color. Here is one set: \documentclass Īllows to fill a given hexagon using two different colors (as two of the hexagons in the image of the question). If you want to use the polygon nodes, you can use the. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |