question

Yokota T avatar image
0 Likes"
Yokota T asked Yokota T commented

Detect whether there is an obstacle between objects

Hello all,

I'm trying to simulate radio communication in FlexSim.

I need to detect whether there is an obstacle between objects.

Specifically, I want to detect whether there is an object that overlaps the line connecting the centers of the wireless terminal objects. The CAD shape of the object can be ignored and assumed to be rectangular a cuboid.

What would be the best way to do this?

Thank you.

FlexSim 22.0.4
radio communication
· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Jason Lightfoot avatar image Jason Lightfoot ♦ commented ·
In 3D? Line intersecting cuboid?
0 Likes 0 ·
Yokota T avatar image Yokota T Jason Lightfoot ♦ commented ·
Yes, in 3D. I'll fix my post.
0 Likes 0 ·

1 Answer

·
Felix Möhlmann avatar image
1 Like"
Felix Möhlmann answered Yokota T commented

The line goes through the coboid if it intersects with any of its faces. Each face defines a plane in 3D space. The intersection point of the line with that plane (if not parallel) can be calculated relatively easily. You then have to check whether that point is part of the surface.

The math is summarized pretty well under the following link:

https://www.wikiwand.com/en/Line%E2%80%93plane_intersection

If you take the vectors that define the plane to be equal to the edges of the object (vectors between corner points) then the line intersects the face if 0 <= u <= 1 and 0 <= v <= 1, as mentioned on the linked page.
1656416156877.png1656416212328.pngpnm is the vector between the points pm and pn, same goes for lab.

In the Flexsim the Vec3 Class offers all necessary methods for these calculations. The 'getLocation()' method can be used to get the corner points of the object, serving as p0, p1 and p2.


1656416156877.png (13.6 KiB)
1656416212328.png (18.4 KiB)
· 8
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Yokota T avatar image Yokota T commented ·

Thank you for your response.

I understood the mathematical theory.

So, should I use this decision method to all objects that can intersect the radio communication path?

0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann Yokota T commented ·

Depends on how many objects there are. In general, I would recommend to first to a rough check (distance from object center to line) to see if an intersection is possible. Only then do the check above to improve performance.

The distance can be gotten quite easily:

|pxp0| = |p1p0| * sin(α), where p1 and p2 define the line and p0 ist the objects center

1656484639945.png

0 Likes 0 ·
1656484639945.png (7.5 KiB)
Yokota T avatar image Yokota T Felix Möhlmann commented ·

I see. That's a smart way.

Thank you for your great answer!

0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.