I think I found some issues with the class:
(See examples here)
Image doesn't align with geometry even though geometry svg and image have the same size (see 1-image-on-path)
If I understand the class code correctly it should be possible to manually override this using offset, but it doesn't seem to do anything (should it?). But even if it works I think both images should align out of the box
Scale is not affecting image put on top of polygon (see 1-image-on-path)
When scale is not set, the body is not shown (or maybe scaled to 0). More logical would be a scaleFactor of 1 when it's omitted from the attributes (see 2-path-not-working-without-scale) (especially since the console also doesn't throw an error)
Stroke doesn't work when not used in combination with fill/color (see 3-not-drawing-stroke)
Also: Not a bug (and not limited to this class), but it would be better to call it strokeWeight instead of weight, and fill instead of color, to stay consistent with p5's terminology
Main issue in the bug code: Images need to be loaded in p5.js preload function - otherwise the results are erratic because of the async image loading
The PolygonFromSVG class is designed in a way, that the SVG based polygon used to define the Matter body is assumed to have an identical shape as the overlay image. For this case the Matter center and the image center (not necessarily identical) are aligned. The offset handling has now been extended in PolygonFromSVG, so that the user still can nudge the overlay image in place - but that probably will break on rotation of the Matter body! A general solution for the miss-matched case is not possible because of the different physical and geometrical centers.
Scale is now applied to overlay image as well
Scale is defaulted to 1.0
Stroke only drawing fixed in Blocks (changing the attributes is a good idea, but affects all examples as well - deferred for now)
I think I found some issues with the class: (See examples here)
1-image-on-path
)offset
, but it doesn't seem to do anything (should it?). But even if it works I think both images should align out of the box1-image-on-path
)2-path-not-working-without-scale
) (especially since the console also doesn't throw an error)3-not-drawing-stroke
)strokeWeight
instead ofweight
, andfill
instead ofcolor
, to stay consistent with p5's terminologyMaybe @b-g or @ByronStar