Nodes/comfyui-panels/Polygon Origin at Centroid
ComfyUI Node

Polygon Origin at Centroid

Pivot around where the panel's mass actually is

By bmad4ever·Created 12 months ago·Updated 2 months ago· 41
Polygon Origin at Centroid
    • POLY_3O

    Polygon Origin at Centroid is the pivot node for panels that aren't rectangles anymore. It emits "centroid" on a POLY_3O output, and you feed that into the optional origin input of Rotate Polygon, Scale Polygon, or Skew Polygon so the transform pivots around the polygon's area-weighted center rather than its bounding-box center.

    No inputs, one output - as thin as utility nodes get.

    Here's the distinction that makes it worth a node of its own. The geometric center is the midpoint of the panel's bounding box; the centroid is where the polygon's area actually balances. For a clean rectangle the two are identical, and since most panels start life as rectangles, you can use either and see no difference. But the moment you Skew a panel into a parallelogram, or Rotate it into a lopsided shape, or feed in an irregular panel, the centroid drifts toward the fat end of the shape while the center stays anchored to the bbox. Rotating around the centroid keeps the panel's mass roughly in place; rotating around the center makes the whole shape swing.

    When does that matter in a comic page? When you're fine-tuning a distorted panel and want it to feel like it turns around its own substance rather than sliding around the page. If a skewed splash panel keeps wandering out of its gutter when you nudge its angle, switching the pivot from Center to Centroid is often the fix - the panel stays put where it visually lives, instead of where its bounding box says it is.

    A reasonable default policy: keep Center wired while your panels are all rectangles, swap in Centroid the moment you start distorting them, and let Vertex or Point handle the compositional pivots (growing from a corner, swinging on a hinge). It's one of those small nodes you'll barely think about - until a rotated panel lands somewhere surprising, and then it's exactly the knob you need.

    Installing

    Part of comfyui-panels by bmad4ever. Via ComfyUI Manager (search "comfyui-panels") and restart, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/bmad4ever/comfyui_panels
    

    Deps: shapely, matplotlib, opencv-python - no models, no GPU. Shapely is pinned exactly; version clashes with other packs are the realistic import failure.

    CategoryBmad/Panels

    Inputs (0)

    No inputs

    Outputs (1)

    NameTypeDescription
    POLY_3OPOLY_3O