Skip to main content
Best Answer

Adjust vertex order in triangle

  • January 14, 2021
  • 5 replies
  • 31 views

whkarto
Contributor
Forum|alt.badge.img+14

Hi guys,

 

I'm looking for a way to adjust vertex order in triangles. First point should be the one with smallest angle between two edges. Remaining vertixes are to be oriented counter clockwise. Is there a build in transformer that offers such functionality or does anyone have a ready to use solution/idea?

 

Thanks in advance!

Best answer by ebygomm

  1. Extract coordinates
  2. Work out each angle
  3. Rebuild geometry starting at coordinate at smallest angle
  4. Check orientation
  5. Reverse orientation if not counter clockwise already

CaptureCapture

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

5 replies

Forum|alt.badge.img+1
  • January 14, 2021

Hi! Now this seems like a fun challenge. If it's an equilateral triangle, what do we expect to happen then? Or if two angles are the same?

 

I'll sketch something up for the default case and see what we can make of it. Do you have some sample data, or can any ol' triangle work for my trials?


ebygomm
Influencer
Forum|alt.badge.img+46
  • Influencer
  • Best Answer
  • January 14, 2021
  1. Extract coordinates
  2. Work out each angle
  3. Rebuild geometry starting at coordinate at smallest angle
  4. Check orientation
  5. Reverse orientation if not counter clockwise already

CaptureCapture


whkarto
Contributor
Forum|alt.badge.img+14
  • Author
  • Contributor
  • January 15, 2021
  1. Extract coordinates
  2. Work out each angle
  3. Rebuild geometry starting at coordinate at smallest angle
  4. Check orientation
  5. Reverse orientation if not counter clockwise already

CaptureCapture

Hi @ebygomm​ ,

 

that looks very promising! I'm currently fiddling with the GeometryReplacer. Which Geometry Encoding Option are you using to pass your triangle attribute over?


ebygomm
Influencer
Forum|alt.badge.img+46
  • Influencer
  • January 15, 2021

Hi @ebygomm​ ,

 

that looks very promising! I'm currently fiddling with the GeometryReplacer. Which Geometry Encoding Option are you using to pass your triangle attribute over?

I create an attribute which is a string of well known text (WKT)

 

e.g. POLYGON ((10 5,0 0,10 0,10 5))

and then use this as the geometry source with encoding of OGC Well Known Text


whkarto
Contributor
Forum|alt.badge.img+14
  • Author
  • Contributor
  • January 15, 2021

Hi @ebygomm​ ,

 

that looks very promising! I'm currently fiddling with the GeometryReplacer. Which Geometry Encoding Option are you using to pass your triangle attribute over?

Managed to figure out, you've been using OGC Well Known Text. I've had a typo (missing bracket) in my POLYGON string.