Some thoughts on center



  • After stuggling a bit with using the new center() function vs. using center attributes, I have a few thoughts. It's is very possible that I'm just thinking about this all wrong as I am more a user than developer.

    My understanding of the current direction is that the center attribute in primatives is being removed in favor of center() or eventually centerAt(), centerAtX(), etc.
    centerAt takes a 'center' and 'axes' but first assumes the center of the object is it's 'natural' center - basically 1/2 the measureBounds().
    As I understand it, if I want to use a different center, I set that as centerAt({center:[0,0,15]) for example.

    So my question is why wouldn't I want to give each primitive or object a center attribute then have centerAt() use that guided by the 'axes'?

    example:
    c = cube({size:4, center:{-2,-2,0]})
    centerAt({axes:[true,true,true]}, c)

    initial placement of the object would still be to center the natural center of the object at the [0,0,0] point, but centerAt() would place the cube's redefined center point at [0,0,0] - in this case it would be placed like a V1 cube.

    This center-point could also inform rotate() so my cube would rotate round a point [-2,-2,0] from it natural center point.

    This also makes me think there should be a way to set a center-point for objects other than primitives like unions.

    I got to thinking about this all after trying to use Inkscape to make little people-shaped silhouettes that bend or rotate at the joints. Inkscape lets you move the point of rotation, but it messes them up when you 'union' several parts together.
    I could then imagine little jscad 3D people where I could articulate them at the joints by setting a center-point at an elbow, for example, then just rotate() it.

    I say all this knowing I'm not offering to code it, and recognizing there is tons to do on the current code base and few hands doing. So just an idea to mull over.



  • @faithhack thanks again for the feedback.

    the 'center' option has been added back to primitives. we want to define primitives using simple mathematics, which means center is required.

    for example, a circle is a shape consisting of all points in a plane that are a given distance from a given point, the center.

    hopefully, this brightens the day of a few folks.


Log in to reply