1. NodeBox 1
    1. Homepage
    2. NodeBox 3Node-based app for generative design and data visualization
    3. NodeBox OpenGLHardware-accelerated cross-platform graphics library
    4. NodeBox 1Generate 2D visuals using Python code (Mac OS X only)
  2. Gallery
  3. Documentation
  4. Forum
  5. Blog

Clamping paths

Paths in NodeBox can be forced to fit a bounding box. Then as the size of the box is adjusted the path will stretch accordingly. This reverse logic is useful in some situations where a path needs to exactly fit an area and we don't want to be bothered with creating the shape in exactly the right proportions or at the right position.

path.fit(x=None, y=None, width=None, height=None, stretch=False)

All of the parameters are optional so you can define any combination of them:

  • x: the path will be positioned at the specified x value.
  • y: the path will be positioned at the specified y value.
  • width: the path will be of the specified width.
  • height: the path will be of the specified height.
  • stretch: if both width and height are defined, either stretch the path or keep the aspect ratio.