Sunday, September 12, 2021

I didn’t get all of that done, but I’m working on it now. I still need to make a triangle fan out of each of the four subdivisions, but I suppose I have four partial fans going on, between the center of my world polygon and the edges. I have four daughter polygons going on, but no areas calculated and summed up, yet… I do need at least some subdivision  of these oval pie slices, because as they stand they are two sides of a flat object, not even a low poly polyhedron!

On a side note, my oval-shaped world polygon/ world peach polyhedron is more or less a variation on my square-to-octahedron. In fact, I can turn the faces of any platonic solid (or the polygons of any other polyhedron) into triangle fans with subdivision, but this is what I’m working on/obsessing over right now and it maps fairly easily from 2D to 3D. Latitude is always based on the height of a point inside my world polygon and longitude varies based on height and width; a world rectangle would be better for this, but I hate using that if I can avoid it, because of the polar distortion.

A nice triangle to tetrahedron subdivided to 24-sider is the simplest way of doing all of this (tetra to poor vinnies 24-sided icosahedron equivalent), with the four triangle faces subdivided six ways into a triangle fan.


Saturday, September 11, 2021

Four Triangle Fan Landmasses

I am subdividing this into four triangle fans and those into polygons which may or may not touch. For several reasons I am making the poles two corners ot the quad and the other two are on the east and west edges...

 No, I didn’t spend today obsessing about it. I didn’t do much more than mow the damn lawn, although just now I came up with a new scheme for subdividing my world peach polymesh/polyhedron thingee! 8-P

Subdivide the oval-shaped world polygon  by picking three or more points. We could do this with two points as long as we find the center or just a point within these two halves to be the center and make a triangle fan, then reduce the two triangle fans by picking points somewhere along the line between the center and the polygon vertex. If I make sure the numbers are sometimes two or more consecutive ‘ones’ then the polygons may even touch. I do need to be careful that the polar triangle fans are more than a pair of triangles, pretty obviously. I could guarantee this by making those two points of a quad, with the other two points lying along the east or west edge, which, don’t forget is the seam where my world peach wraps around. These two really should never be corresponding points, or the center of the quad triangle fan lies along the prime meridian and I don’t want that, but stuff happens. We can get the second and last random points between the poles in a fairly straightforward fashion.

I will need to keep track of where polygons touch...


Friday, September 10, 2021

I can make my usual world peach polygon with a set of points down the backside from pole to pole, and draw some random points from each pair down the backside; they are on either side of my oval-shaped polygon but are really the same point, where the world wraps around from east to west, weat to east. This is simple enough, since the distance is px1 - px0, and i can add them randomly, say 10 px plus some random amount, or maybe 1% or so, since this is actually not in pixels but percentages across the polygon, since I’m using clipPath and shapeOutside...

Now, about clickable objects; I am having unexpected difficulties here and it would be nice if I could use the mouse instead… I want to be able to create unique events in the same way I’d create any other object with javascript. I was thinking that I could make the event listener switch based on where the mouse is, but I’m still having a lot of trouble with the mouse within my document, at least when I copy paste to my blog! Grrr…

I can reset and remove divs with a nice button for the user, but I still want to be able to have the user interact mor with the world map! Just get something interesting up on the blog, Vinnie!!!

I start and end with triangle fans at the poles, then we have rows of quads in between, subdivided into triangle pairs and subdivided further where the distances between points are too great. Thinking about it, the first line of points is between two endpoints at the seam where the world wraps, so we can copy them down and stretch them out or or add in new points between the endpoints and the adjacent points, the 2nd and 2nd to last points. That second idea has some merit, but I want an offset, so that the next line of points is the two new endpoints plus the midpoints between each of the points on the previous line. Then subdivide edges and triangles as needed….

(I know nobody ever reads this, because they never comment about how I don’t make any sense)


Thursday, September 9, 2021

Nope, I haven’t been writing, and I haven’t even been coding things. I will write my drabble and get to bed.

Back to quads and my oval-shaped world peach polygon. We actually subdivide a square and move points which are outside of the radius of a circle within the square, inward. The square is subdivided into quads whose points are moved as needed to lie within the world oval/circle. One square world quad becomes two, which are further divided into triangle fans. If the square is divided vertically, one will likely be wider than the other, in which case the corners of the smaller quad/triangle fan subdivide the larger quad into a hexagon. Instead of worrying about further subdividing quads, we can pair any two adjacent triangles as quads which we can further subdivide into four triangles of a triangle fan and make that the center of a landmass or ocean. I’m doing a horrible job of explaining this, but each of these triangle fans can be turned into a jagged blob of four or more points; the outer edges of the triangle fan can be subdivided but they do not have to be, we can ‘pencil in’ a point and find a point somewhere back along the line from this imaginary point to the center, discard that subdividing point and subdivide that triangle into three or more daughter triangles...

Monday, September 6, 2021

Points!

this seems like the same old thing, but I have a function dynamically generating the clickable functionality, only the page keeps freezing up on me and then crashing...
Anyway, that's not what I wanted to do tonight, I want to get an animation loop running and make a subdivided triangle fan.

No, I didn’t work on the novel all weekend… so I’m just going to get my words in, copy and paste a post to the blog and go to bed! (On the next page…)

I can make the oval-shaped world polygon and fill the polygon with random points which are inside of the oval, which is actually a circle, but twice as wide… so when I get a random width, minus the center point, I divide the x position in half. Actually, x position is already in unit circle distances and width is +/- pi, while height is 0 to pi but I think of it as +/- 90 or +/- ½ pi. Anyway, I can then find the closest point to each sequential pair of points in my world peach polygon to start building my triangle mesh. We make a list of open inner triangle edges and start going through them to find the nearest point or edge to make some more triangles. If the inner open edge already exists, then we know that two triangles are adjacent and we map them as adjacent so that they refer to each other through that unique edge. These initial outer triangles each pair up with another one, wrapping around edge to edge across the seam of my world peach. Each edge shares a triangle and it belongs with two different vectors which run clockwise around the triangle; each edge is a pair of vectors useful for building up complex polygons from a mesh of individual triangles.

So each triangle is a set of three points and three edges which are open or closed, three other possible adjacent triangle neighbors. Each edge has a length, which we can use to calculate the area of the triangle using Heron’s formula or get it with the dot product. The cross product could be used to find if a point is inside or outside of a given triangle, and therefore find points outside with which to build adjacent triangles. Or I can use the atan2 function to get the angle in radians. But I can probably, possibly, get away with pairing up the closest points and adjacent sides. If a point is closer to some edge on one triangle and is also closer to the nearest edge of the next outer triangle, then make that triangle. There won’t be, otherwise that point would probably have been the closest point to one of those two adjacent outer triangles. 

  1. Make a list of points for my oval world peach polygon. (already done)

  2. Make outer triangles which pair off, wrapping around left to right and right to left.

  3. Each triangle has three points, listed in clockwise order, three edges, three neighbors and an area.

  4. Make a list of edges and use this to pair up triangles, referencing the triangle neighbors in clockwise order, closing open edges as we find them and removing closed edges from a list of open edges as we find them; also adding open edges as we make triangles.

  5. Look for points to pair up with open edges to make new triangles, checking triangles and removing now closed edges as we make more triangles while adding open edges.

  6. Continue until we close off all the open edges and have made a closed triangle mesh.