How can I understand Entities#intersect_with method?

This is the method signature of intersect_with method on API doc:

#intersect_with(recurse, transform1, entities1, transform2, hidden, entities2) ⇒ nil

But the explanation of this method is very simple, and I just can’t understand the parameters at all…
So does anyone could help to explain why we need transform1, transform2, and what is entities2?

entities.intersect_with(recurse, transformation1, entities1, transformation2, hidden, entities2)

Parameters:

  • recurse (true/false)
    true if you want this entities object to be recursed (intersection lines will be put inside of groups and components within this entities object).

  • transform1
    The transformation for the initial entities object [where it is placed/rotated/scaled etc].
    Can be a new ‘neutral’ transformation - e.g. Geom::Transformation.new

  • entities1
    The entities object where you want the intersection’s edges to appear - e.g. some_group.entities

  • transform2
    The transformation for entities1 (can simply remain where they are, or elsewhere
    e.g. can be a new ‘neutral’ transformation - e.g. Geom::Transformation.new)

  • hidden (true/false)
    true if you want hidden geometry in the entities object to be used in the intersection.

  • entities2
    A single entity, or an array of entities (if you are intersecting it with a container’s entities you can use e.g. some_group.entities.to_a) - this will be used to find their intersection with entities, and that intersection results [edges] go into entities1.


It is probably the most complex and convoluted method going... But it is useful... Try using it on some simple objects so you can see and understand the results...
2 Likes

I logged an issue to further improve the documentation for that method.

1 Like