# Ray bounce and parallel lines

Good morning everyone,

I am developing a script to calculate the depth of rooms relative to the wall with windows. Currently, I use ray-bounce to measure the distances between the window and the wall in front of it, but I also need to know the maximum depth of the room (ALWAYS IN THE DIRECTION PARALLEL TO THE RAY-BOUNCE). This is because if the room has an articulated shape or there are obstacles like in the image, the value of the room depth must always be the maximum existing one.

I thought of using the bounding box for the rooms first, so whatever shape the room has, it returns the maximum depth. However, with the bounding box, I cannot extract (doing room bounding box â cuboid, i can only extract width and depth, but it doesnât tell me which curve is one and which is the other, so I canât verify that the greater of the two is parallel to the ray-bounce.) the curve of the cubeâs side to query it and check if its direction vector is parallel to the ray-bounce vector.

In essence, I need advice on how to obtain the single roomâs edge curve constituting the longest side parallel to the ray-bounce.

Thank you all!

Hi @f.amman not really sure is it something here you are afterâŚif so here is a dirty way there probably could work

hi @sovitek the rays should remain contained within the room. I think setting a number of âpassthroughsâ is dangerous because, if I have a room without obstacles, the ray could go outside the room, as it seems to happen in the room on the left in the video.

allright as here ?

yes how do you make only âobstacle wallsâ to be trapassed? and boundry ones solid?

Just filter that wall out [many ways it can be done] then temp hide that wall and then raybounce and then unhide again and thats why we need some passtrough

i would like to find an automatic way for get the job done, cause of the building is big i cant go around hiding walls, error is behind the corner!
any idea?

Not really then, right nowâŚbtw everything is automatic in my exemple [except select windows but could be automatic as well] without error and cant see error around corner even on big models but will probably run a little bit slowerâŚgood luck with that

Iâd skip the ray bounce entirely.

1. Select the room
2. Get the perimeter curves and patch to a surface
3. Grab all windows in the room
4. Get the transform of each window (a coordinate system)
5. Transform the surface from the windowâs coordinates to the origin coordinate system
6. Pull the bounding box of the transformed surface
7. Pull the maximum point of the bounding box and get the Y component - this is the depth of the room relative to the window

That said, if youâre looking to find âpercentage of the room with light from a windowâ youâre likely better off looking at VASA as it will manage this much faster and more accurately than ray casting.

1 Like

yeah good idea i just tried with ray as the user askâŚbut could probably be done other way as wellâŚdepends

1 Like

Continuing the discussion from Ray bounce and parallel lines:

sovitek is it possible to see your script? Thank you

sorry dont have it anymoreâŚbut basicly i just filter that wall out there dont connect to other, and then make a temp hide, raybounce and then unhide againâŚ try it or try what Jacob suggestâŚgood luck

thanks, in the end solved whit roome bounding box longest edge
look at the result

thanks to all

script available?