Question

Extract triangles out of areas by angle?

  • 29 February 2016
  • 4 replies
  • 1 view

Hi!

I have a DWG-File with an area-layer, containing geometries and i want to seperate triangular areas (see Screenshot).

 

All geometries in the Screenshot are in the same layer. I tried to extract the triangular areas, but didn't find a way that works.

Facts:

 

- the triangles are not identical and have different areas (calculated by ExpressionCalculator) and different number of vertices (count by ExpressionEvaluator)

 

- all triangles have more than 3 vertices

So, I can't select these geometries with a Tester by area or number of Vertices...

Is there a way to calculate the angle of geometries or a another way to seperate these triangular areas?

 

Thanks for help!

Juli


4 replies

Userlevel 4

Maybe you could try to generalize the geometries before counting the number of vertices? That could help getting rid of extraneous vertices.

Badge +2

Hi,

Just a hint: Closed / Open polygons will make the difference...

Pratap

Userlevel 4
Badge +25

Hi @juli

I figure you should be able to find the triangles because they will have 3 (or fewer) interior angles <90 degrees. A rectangle would have more.

So... I created this workspace. You can download it with test data here:

https://www.dropbox.com/s/qumhpmagurj3km5/SpotTheTriangles.fmwt?dl=0

It seems to work well on spotting triangles, but also the occasional rectangle creeps through. I think it would depend on your source data. Here the data is building footprints, which are fairly rectangular (in fact I have to drop points out of a few to make triangles).

The angle test I actually set at 92 degrees. You might get better results by changing that - I can't decide whether up or down would work better. Probably upwards would filter out more rectangles (of one type) but let through different ones.

Anyway. I hope this helps

Mark

Badge +3

@juli

If the triangles have areas they obviously are closed and are polygons, and have 4 or more vertices .

Not closed triangular polylines have four or more vertices but no area. (last vetex has same coordinates as first)

If a polygon boundary cannot be generalised to 4 vertices, they are not true triangles.

So to identify true triangles all you need to do is test for vertexcount = 4.

To test for "trianglishish" area's you could use this:

Tolerance to set triangle acceptence rate.

Works by the assumption that any triangle is 50% of the area of its oriented boundingbox. (try it out)

Reply