Skip to main content
Solved

Adjust vertex order in triangle


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

View original
Did this help you find an answer to your question?

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+31
  • 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
ebygomm wrote:
  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+31
  • Influencer
  • January 15, 2021
whkarto wrote:

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
whkarto wrote:

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.


Reply


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