Skip to main content
Question

aspect calculation


Forum|alt.badge.img

I have 3D polygons where I need to calculate the aspect for each polygon and add it as attribute. Is there a way to do this? I found a transformer to calculate the aspect for raster but not for vector ,is there a way to go around? Thanks !

18 replies

daveatsafe
Safer
Forum|alt.badge.img+19
  • Safer
  • October 4, 2018

Hi @irene2018,

You can use the FaceReplacer to convert the 3D polygon to a face, then use the PlanarityFilter to get the normal for the surface. The X and Y components of the surface normal can be used in the atan2 arithmetic function to calculate the aspect angle of the surface.

This will be a cartesian angle (CCW, 0 at horizontal), so you may need to convert this to a compass bearing (CW, 0 at vertical).


Forum|alt.badge.img
  • Author
  • October 5, 2018

thanks a lot! I will try this


itay
Supporter
Forum|alt.badge.img+17
  • Supporter
  • November 6, 2018
daveatsafe wrote:

Hi @irene2018,

You can use the FaceReplacer to convert the 3D polygon to a face, then use the PlanarityFilter to get the normal for the surface. The X and Y components of the surface normal can be used in the atan2 arithmetic function to calculate the aspect angle of the surface.

This will be a cartesian angle (CCW, 0 at horizontal), so you may need to convert this to a compass bearing (CW, 0 at vertical).

Hi @DaveAtSafe would you mind elaborating on how to transform the result of the atan2 function from cartesian angle to a compass bearing?

I am currently using the atan2 function in a ExpressionEvaluator transformer as follow:

@atan2(@Value(_surfaceNormalX),@Value(_surfaceNormalY))

This after calculating the surface normals (X and Y) via the PlanarityFilter transformer.


daveatsafe
Safer
Forum|alt.badge.img+19
  • Safer
  • November 6, 2018
itay wrote:

Hi @DaveAtSafe would you mind elaborating on how to transform the result of the atan2 function from cartesian angle to a compass bearing?

I am currently using the atan2 function in a ExpressionEvaluator transformer as follow:

@atan2(@Value(_surfaceNormalX),@Value(_surfaceNormalY))

This after calculating the surface normals (X and Y) via the PlanarityFilter transformer.

Hi @itay,

To convert from cartesian to a compass bearing (or vice versa), you can use fmod((450 - angle), 360).

However, the result of atan2 is usually radians, so you will need to multiply that by 180/pi first to get degrees.


itay
Supporter
Forum|alt.badge.img+17
  • Supporter
  • November 6, 2018
daveatsafe wrote:

Hi @itay,

To convert from cartesian to a compass bearing (or vice versa), you can use fmod((450 - angle), 360).

However, the result of atan2 is usually radians, so you will need to multiply that by 180/pi first to get degrees.

Thx @DaveAtSafe


Forum|alt.badge.img
  • Author
  • November 7, 2018

would you please explain how to use the PlanarityFilter to get the normal for the surface.


daveatsafe
Safer
Forum|alt.badge.img+19
  • Safer
  • November 7, 2018

Hi @irene2018,

If you open the properties of the PlanarityFilter, there is a setting at the bottom to calculate the surface normal:

The surface normal will be supplied in three new attributes:

_surfaceNormalX

_surfaceNormalY

_surfaceNormalZ


Forum|alt.badge.img
  • Author
  • November 8, 2018

@DaveAtSafe thanks! and if I want to calculate aslo the inclination of each polygon ,What should I do?


daveatsafe
Safer
Forum|alt.badge.img+19
  • Safer
  • November 8, 2018

Hi @irene2018,

The inverse cos (acos) of the Z component should give you your inclination off the horizontal.


Forum|alt.badge.img
  • Author
  • November 9, 2018

@DaveAtSafe the z component is the _Zsurface normal?


daveatsafe
Safer
Forum|alt.badge.img+19
  • Safer
  • November 9, 2018
irene2018 wrote:

@DaveAtSafe the z component is the _Zsurface normal?

Hi @irene2018,

Yes.


Forum|alt.badge.img
  • Author
  • November 12, 2018
irene2018 wrote:

@DaveAtSafe the z component is the _Zsurface normal?

@ Dave At Safe, thanks for your clear answer! . Does this also need to be converted to a compass bearing and then multiply that by 180/pi to get degrees?

 


daveatsafe
Safer
Forum|alt.badge.img+19
  • Safer
  • November 12, 2018
irene2018 wrote:

@ Dave At Safe, thanks for your clear answer! . Does this also need to be converted to a compass bearing and then multiply that by 180/pi to get degrees?

 

Hi @irene2018,

It doesn't need to be converted to a compass bearing, but the result will be in radians, so you do need to multiply it by 108/pi to get degrees.


Forum|alt.badge.img
  • Author
  • November 13, 2018

Hi@DaveAtSafe , I have problem with face replacer transformer ,as not all polygons are planar ,I passed by geometry validater transformer that has corrected the problem but the type of polygons has changed to "FME_aggreate" so the face replacer doesn't work ,is there a solution for that?Thanks!


daveatsafe
Safer
Forum|alt.badge.img+19
  • Safer
  • November 14, 2018
irene2018 wrote:

Hi@DaveAtSafe , I have problem with face replacer transformer ,as not all polygons are planar ,I passed by geometry validater transformer that has corrected the problem but the type of polygons has changed to "FME_aggreate" so the face replacer doesn't work ,is there a solution for that?Thanks!

Hi @irene2018,

Try setting the Thickness Mode on the FaceReplacer to Ignore. This will skip the planarity check. You may also want to set the Angular Mode to ignore as well.


Forum|alt.badge.img
  • Author
  • November 15, 2018
daveatsafe wrote:

Hi @irene2018,

It doesn't need to be converted to a compass bearing, but the result will be in radians, so you do need to multiply it by 108/pi to get degrees.

Thanks @ Dave At Safe ,I was able to calculate but the inclination of flat roof should be between 0 to 15 degrees and I have 80 so i missed something. I calculate the z normal and then do acos (z normal component *57.295


daveatsafe
Safer
Forum|alt.badge.img+19
  • Safer
  • November 19, 2018
irene2018 wrote:

Thanks @ Dave At Safe ,I was able to calculate but the inclination of flat roof should be between 0 to 15 degrees and I have 80 so i missed something. I calculate the z normal and then do acos (z normal component *57.295

Hi @irene2018,

Please move the '*57.295' outside of the acos() expression.


Forum|alt.badge.img
  • Author
  • November 20, 2018
daveatsafe wrote:

Hi @irene2018,

Please move the '*57.295' outside of the acos() expression.

Hi@ Dave At Safe ,the result is not logic ,the pitched roofs have an inclination of 2.5 degrees while flat roof has 3 degrees ,i can send you the vector file if needed


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings