Skip to main content
Hello,

 

Any idea on resolving this? I have a set of stars around the hemisphere, each being a point with x,y,z sphericaly located 100.000 km away from the centerpoint. I need an analysis of which stars are visible from the centerpoint through an arbitrary located roofwindow. A horizontal roof analysis is sufficient, window is represented by a 3D polygon with respective z-coordinate.

 

I tried almost everything, the closest match is creating a line between a centerpoint and a star and see if it goes through the window. However, the most suitable transformers (intersector and spatial filter) are apparently not handling the 3D intersections correctly.

 

I will highly appreciate any fresh ideas.

 

Thank you in anticipation,

 

 

Jaro
🙂 FME and astronomy? That's a new one for me....

 

how do you define the filed of view? Is it the window projected so many kilometers or a widening area?
The field of view is funnel-like shape, i.e. a part of the sky which you see through the window. Like this:

 

 


Hi Jaro,

 

 

3D coordinates (x, y, z) of stars and windows can be projected onto the same 2D coordinate system (longitude, latitude) on the hemisphere.

 

-----

 

d2: 2D distance = squareroot(x^2 + y^2)

 

d3: 3D distance = squareroot(x^2 + y^2 + z^2)

 

longitude =

 

  eastern hemisphere (0 <= y):  arccos(x / d2) (radian]

 

  western hemisphere (y < 0):  -arccos(x / d2) cradian]

 

latitude = arcsin(z / d3) cradian]

 

-----

 

FME Math Functions contain all the required trigonometric functions i.e. @asin, @acos.

 

After the projection, you can compute spatial relationships among them on the 2D coordinate system (LL), using the SpatialFilter etc.

 

Just be aware that the wihdow should be divided into eastern hemisphere part (0 <= y) and western hemisphere part (y < 0) if it was belonging to both hemispheres.

 

 

Takashi
p.s. Generally, straight lines in XYZ coordinate system will be distorted on the LL coordinate system after the projection. That is, a rectangle window will not be an exact rectangle in LL. To reflect the distortions as much as possible, consider using the Densifier before the projection.
Mmmm... yes, you are right. Now the difficult part is to project window ono the sky and then back to the 2D coordinate system (LL). However, there is not an FME beauty present in this solution. I would just expect a workflow like this: here is a bunch of lines, here is a polygon (surface) floating in the air, take spatial filter and give me those lines that are pertruding through the polygon.

 

But it is the only solution I have for the moment (which I thank you for), so back to work now...
Ah... sorry. Descriptions in my 3rd post may be wrong. I removed it once, will think again.
A computational geometric solution.

 

 

1) Form the equation of the plane which contains the window surface.

 

a*x + b*y + c*z + d = 0

 

a, b, c, d are constants, those can be calculated based on 3 coordinates (i.e. 3 vertices of the window): (x1, y1, z1), (x2, y2, z2), (x3, y3, z3).

 

a = (y2 - y1)*(z3 - z1) - (y3 - y1)*(z2 - z1)

 

b = (z2 - z1)*(x3 - x1) - (z3 - z1)*(x2 - x1)

 

c = (x2 - x1)*(y3 - y1) - (x3 - x1)*(y2 - y1)

 

d = -(a*x1 + b*y1 + c*z1)

 

# hope that there is no typo...

 

 

2) Calculate the intersection Q (x, y, z) of the plane and a line which passes along the origin (0, 0, 0) and the star (xs, ys, zs).

 

D: distance between the origin and the star = sqrt(xs^2 + ys^2 + zs^2)

 

Unit vector to the star from the origin: (ux, uy, uz) = (xs/D, ys/D, zs/D)

 

Q (x, y, z) can be expressed as (K*ux, K*uy, K*uz), K is distance between the origin and Q.

 

Since Q is a point on the plane, K can be calculated based on the plane equation.

 

a*K*ux + b*K*uy + c*K*uz + d = 0

 

Therefore, K = -d / (a*ux + b*uy + c*uz)

 

If the denominator is equal to zero, the line is parallel to the plane (the star is not visible).

 

 

3) Determine whether the intersection Q is inside of the window.

 

Algorithm which determines whether a point is inside of a general polygon is complicated, but there is a relatively simple way if the polygon is a triangle.

 

So, divide the window into triangles; assume vertices of a triangle as P1, P2, P3.

 

If A(P1P2P3) < A(P1P2Q) + A(P2P3Q) + A(P3P1Q), Q is OUTSIDE of the triangle P1P2P3.

 

Here, A(***) is area of a triangle, it can be calculated by Heron's formula etc..

 

When Q is outside of every triangle within the window, the star is not visible.

 

 

Practically, it might be better to use this test condition to avoid wrong determinations caused by computational error.

 

If A(P1P2P3) < A(P1P2Q) + A(P2P3Q)

 

  or A(P1P2P3) < A(P2P3Q) + A(P3P1Q)

 

  or A(P1P2P3) < A(P3P1Q) + A(P1P2Q)

 

Then Q is outside of the triangle P1P2P3

 

# even so, a computational error cannot be avoid perfectly.

 

 

Please check the logic and expressions carefully before applying.

 

If there were wrong descriptions, please correct them.
Cool. As the window is always horizontal in my case, I think that step 3 may be eased a bit - force 2D and use a standard spatial filter. For steps 1 and 2 you have my respect.
If the window is always horizontal, it's very simple :)

 

-----

 

Coordinate of a star: (xs, ys, zs)

 

Z (elevation) of a horizontal window: zw

 

If zs <= zw, the star can not be visible absolutely. No need to calculate as below.

 

Coordinate of the star projected onto the plane containing the window:

 

x = xs * zw / zs

 

y = ys * zw / zs

 

z = zw

 

-----

 

The Scaler can be used to project stars onto the plane containing the window. You can then apply the SpatialFilter etc. in 2D coordinate system.

 

 

Similarity of geometries.

 

http://en.wikipedia.org/wiki/Similarity_(geometry)

 


Reply