Monday, June 7, 2021

Extruding a pyramid shape from a vector (the difference between two points)

I was thinking about extruding a shape from two random points or two points chosen by the user. This is a pyramid with the four corners of the base derived from the vector given by the two points, dx and dy (dz too, but this is zero by default, unless we work out some way of a z coordinate, in this case you might use the sum of dx and dy from every second, even, point to find this. Anyway, we have a vector and we can swap dy for dx, and dz for dy, add it or subtract it from the second point to derive four points at right angles to the line segment of the first two points. The base is a quad and can be displayed as a quad, a triangle pair or four triangles, and the sides are a cone or prism of four triangles in a triangle fan around the original point.


Of course this could also make an octahedron, pushing six more points out from the second point and duplicating the first point; this is how you start making a sphere from an octahedron. We would use the first point as the origin and define the vector differently, exactly backwards actually, subdividing the triangles three, four or six ways as many times as we want while adding new points and moving them to the radius of the sphere we’re approximating, and this spherical polyhedron is is something we can then pull out on or push in on to make some interesting shapes.


But what I’m trying to do is extrude a boxy tube, which can be rounded by subdividing the midpoints of the sides of the pyramid base to make an octagonal base. Why would I want to do this? I want to make some body plans; most animals and plants can be thought of as cylinders with skin or bark on the outside, bones, muscles and organs on the inside. We can  extrude tubes for limbs by pulling on points and the triangles connected to those points, then subdividing and shaping this extrusion. Or I can wrap a line segment by finding all the pyramid bases and connecting quad corners, one quad after the other, like I want to do with serpentine landmass (this is where I got the idea of course).

No comments:

Post a Comment