Edge intersection
-
Hello, I need to know if an edge is intersected by any entity (group, face,component)
for example in this case:----------------[face]--------------------- there is a face in the middle of the edge
i need a function like
edge.is_intersected? true-------------------------------------------- in this case theres nothing in the edge so
edge.is_intersected? falseBut i dont need a function like (edge.is_intersected_with? face), I just want to know if an edge is intersected by anything. I tried with all_connected, faces, but it doesnt work
Thank You
-
No the API does not have any instance method like that, for the
Edge
class.
Generally instance methods return information that the object knows about itself. In SketchUp edge objects are rather dumb about other objects that have not interacted with themselves.You would have to go UP one editing context, and ask THAT context (
Entities
collection,) if the two objects intersected.Also it is against the API law to create new instance methods. (Only Trimble should modify the API.)
The closest thing you might find, is*:
` result = edge.bounds.intersect(face.bounds)
if result.empty?they did not intersect
else
they do intersect
end`
See Geom::BoundingBox#intersect()
- not a warranty that this will be the solution
There are also Geom module intersect functions.
-
@sandbox_4 said:
Hello, I need to know if an edge is intersected by any entity (group, face,component)
for example in this case:----------------[face]--------------------- there is a face in the middle of the edge
i need a function like
edge.is_intersected? true-------------------------------------------- in this case theres nothing in the edge so
edge.is_intersected? falseBut i dont need a function like (edge.is_intersected_with? face), I just want to know if an edge is intersected by anything. I tried with all_connected, faces, but it doesnt work
Thank You
Do really mean an Edge? As in you don't just want to test whether a ray (an imaginary line in space) intersects an entity, you really want an Geometric Edge (and all the semantics that go with it)?
Adam
-
@adamb said:
Do really mean an Edge? As in you don't just want to test whether a ray (an imaginary line in space) intersects an entity, you really want an Geometric Edge (and all the semantics that go with it)?
Adam
Yes I need to know if the direct path (a imaginary line ) between 2 entities is obstructed or not
For example
[entity1]--------------------[entity2]
in this case theres nothing in the direct path between the entities so i need a function like entity1.line_of_sight? entity2 true
but in this case
[entity1]------[cube]---------[entity2]
theres a cube in the direct path so the direct path is obstructed then
entity1.line_of_sight? entity2 false -
Advertisement