Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Projecting Geometry onto other surfaces

4 REPLIES 4
Reply
Message 1 of 5
grahamcook
477 Views, 4 Replies

Projecting Geometry onto other surfaces

Just looking at a potential project and whether the tools available within the Revit API could combine to get me the end result.

Here’s a simple example of what I’m after. Take a single room model with a single window. You are stood inside that room looking out through the window. I need to be able to measure how much sky you can see as a percentage by projecting the window onto a dome (the sky) that envelopes the whole model. I know there are complications with obstacles etc. but if I can get any pointers on where to start or indeed if it’s possible that would be a good starting point. I’ve browsed over the ReferenceIntersector class and will be looking at this in more detail but not sure if this gives me all I need. I attach an image that better illustrates what I’m trying to do. Essentially, I need to calculate the grey area as indicated in the example image.

 

I appreciate any help / pointers.

 

Thanks

 

Graham Cook

4 REPLIES 4
Message 2 of 5
Scott_Wilson
in reply to: grahamcook

I'm quite sure there is a way to do what you need. I'm a little confused though, what significance does the dome have? Is it solely to represent the sky, ignoring curvature of earth, terrain and other adjacent buildings? You then wish to project the viewing extents of a person at a particular location through the window and onto this dome before calculating this area as a percentage of the entire area of the sky dome?

 

If that's correct, how will you account for the horizon line without having the dome at some ridiculous distance from the viewer? Would you be truncating the lower portion of the dome at eye-level so that anything below horizon would not be projected onto the dome? How would you then get the correct percentage of the full hemisphere as the truncated dome would have less area resulting in an inflated percentage. These are just some thoughts I had and I could be interpreting your problem incorrectly, if so just ignore my ramblings. 🙂

 

If I am reading you right, there is an easier way (well I think it's easier anyway), Instead of working with surface area, keep everything as angles. You can calculate the same % figure with some basic trigonometry. Just calculate the frustum angles between the viewer position and the window frame edges (the Tangent function should be all you need). These angles can be used to get the percentage of sky by taking the included angles (one each for vertical and horizontal), multiplying them together then dividing that by the product of 360*180 (or 2PI² if you keep everything in radians).

 

The result is a percentage of arc in 2 dimensions which should in theory be more accurate than calculating the projected dome area as you have less rounding steps involving PI in the calculations. This still leaves the problem of horizon though, one way to handle this would be to remove any portion of the vertical frustum angle that dips below horizontal before doing the calculation.

 

 

 

Message 3 of 5
grahamcook
in reply to: Scott_Wilson

Hi Scott

 

First off thank you for your input and observations. You are correct in your assumptions, the dome represents the sky, there will be terrain and surrounding buildings, there may even be internal obstructions like columns. Perhaps I over simplified the original example so I attach another image showing the issue from the camera side.  The area that I need to “project” onto the makeshift sky (the dome) is shown in red outline.  As you can see this shows some external contextual buildings obstructing the view.

 

RoomView.jpg

 

Your suggested approach (using frustum angles) would perhaps be more straight forward but the introduction of external obstacles would scupper that idea (if I understood it correctly).

 

Now I have had a chance to read up a bit more on the ReferenceIntersector class my thought process of using that class is to first get all openings in the room. Then from the eye point, shoot rays in the direction of each opening (the number and density to be an input).  As far as I can make out this will return a collection of elements that the ray intersected (using the .Find() method), from this I can determine if a Ray hit any other objects before hitting the dome.  If there are no elements between the opening element and the dome element I know this ray was unobstructed and would create a point on the dome.  Likewise if there was an element between the eyepoint and the opening I know this ray did not make it to the dome.  So using only the ray objects that made it unobstructed to the dome I could extract the points at which the ray hit the dome which would represent the projected area within the red line.  I guess the accuracy would be based on the number of the rays (the more rays you add the longer it takes, but with more accuracy).

 

How I would convert these points into a surface I don’t yet know. Anyhow, not backed any of that theory up with examples yet, just thinking aloud at this point…

 

Regards

 

Graham cook

Message 4 of 5
Scott_Wilson
in reply to: grahamcook

Ahh, I see now. This looks like a nice meaty problem to solve, I wish you luck.

 

I think it would still be beneficial to calculate the frustum as a first step so that you have some define boundaries which you can then evenly cover with ray projections.

 

I wonder if there is any way to get at the lighting / shadow information. It would be nice to just place a point light at the eye position and see how much light hits the dome.

Message 5 of 5
Scott_Wilson
in reply to: Scott_Wilson

Another though I just had:

 

What if you were to use a well defined gridded texture for the dome. You could take a bitmapped screen shot similar to the one in your second post then analyse it to determine the visible dome area. making both the background and grid lines in unique colours would make it fairly simple to analyse.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community