Wednesday, October 6, 2021

I need to get my words in… Off on another tangent, but back to making graphics with CSS in the DOM, I can take my XY offset finding code and revise it to build a line of points as a sring of quads; with two points I have a vector and can push out some points to either side of the midpoint of the line segment between these two points to make my quad. These quads between each two consecutive points in a list of points are a good place to restart my attempt to make serpentine landmass. I can build each line segment/quad triangle fan/point pair as an object and save the different components to refer to and use to make some bridging points and triangles at the joints between the quads. So we can make a line segment/quad triangle fan object with, additionally, the adjacent side points of each joint. This is a preceding point and any possible preceding point adjacent side points, which will not exist at the first and last point, unless we do a placeholder… anyway, three preceding points, three midpoints and three following points, turning the quad triangle fan into an octagon triangle fan. This turns each line segment into a polygon and means we could potentially build a serpentine landmass polygon.

The adjacent side points of each user point and midpoint are the product of some math based on the dx and dy of the vector defined by each line segment, which can be derived simply enough, or modified randomly, or by input from the user, moved around after the page generates them. Keep it simple, get the dx and dy and do some math to build each preceding, middle and following adjacent point, save the point, save the pint index to the polygon segment object and build each polygon in CSS! Yeah, simple…

I do owe myself some work on the story, but I want to get some code written and posted tonight, so off I go to do that and post yet another placeholder, probably!


No comments:

Post a Comment