Interest of using glPolygonMode OpenGL command - polygon

When reading the specification of glPolygonMode(), I have the feeling that it is just an alternative way to fill a polygon with the desired color.
Am I right?
Because if yes, what is the benefit of using this command to fill a polygon, rather than just using glVertex() commands which fills the polygon by doing the interpolation between the specified polygon vertices?
I am using OpenGL SC 1.0.1.

Related

Subdividing a polygon around a point in R or ArcPro

I am trying to create a 5ha plot around a point within a permissions layer. The permissions layer doesn't always extend 5ha around the point in a square so I cannot clip it. I would like to automate this process.
My current approach is to clip 5ha around the points and then use those where it creates a full square.
Then Use the subdivide polygon tool in Arcpro and use the polygons where the point is mostly in the centre.
Then draw the 5ha manually for the rest of the polygons.
Is there a way to automate this process in R? I've only found how to subdivide the polygon into equal areas.
Thanks

How to do rounded tapers in sketchup

how to do rounded tapers like this on sketchup 2018? What I did was, drawing the shape on both surfaces and tried deleting the surfaces. But it didn't create a new surface on taper. As you can see it has a hole, that you can see inside of that column, I want to fill it with a surface, so it can't be see through.
http://i68.tinypic.com/kbsu1s.jpg -- the sample pic
The simplest way is brute force. Turn on hidden geometry (View -> Hidden Geometry) and connect the opposing points to create faces.
Alternatively if you have a shape that matches the cutout, you can use intersection to create the fill faces. If you are new to SketchUp, I recommend learning about intersection (a simple google search of 'SketchUp intersection' will give you a great starting point).
You can achieve the desired result by doing the following:
1. Create object you wish to taper and draw the taper shape separately
2. Use the Follow Me tool to turn taper into a solid
3. Make it a component
5. Intersect its faces with model
6. Explode
7. Erase unnecessary geometry
8. Ctrl+Eraser to soften remaining geometry
And you end up with this:
final product

Drawing 2D maps in JavaFX

I'm currently working on project that uses json file with points & polygons.
All input data are a Lat/Lon format. I wish to draw these on a map (Which should be able to pan). I'm able to draw these objects on a JavaFx Pane or Canvas.
The issue is the data line between two coordinates is a straight line while it actually should follow stereographic projection .
I looked into ArcGis and other GeoTools but these tools all build upon tile maps something I don't need for my project.
You will have to create something what we call a LineDrawer. First you have to determine what line type you want to use. Standard line types are great-circle, rhumb and just straight lines. Second you have to define the projection you want to use. So if you now want to draw a line between two points A and B you have to split this up into small enough sections and compute intermediate points according to the formula for your chosen line type and then you have to project these points into your drawing pane.
But that's basically what every GIS software can do for you and you don't have to re-invent the wheel here.

How to construct a mesh from given edge points?

I have some points on the edge(left image), and I want to construct a mesh(right), Is there any good algorithm to achieve it? many thanks!
image can see here http://ww3.sinaimg.cn/large/6a2c8e2bjw1dk8jr3t7eaj.jpg
To begin with, see Delauney triangulation. Look at this project: http://people.sc.fsu.edu/~jburkardt/c_src/triangulate/triangulate.html.
Edited because my original had too few details on edge-flipping, and when I tried to provided those details I found the TRIANGULATE project.
If the region is flat or quasi-flat look for Ear Clipping approach (http://www.geometrictools.com/Documentation/TriangulationByEarClipping.pdf). In the case of curved surface you need point inside the region and therefore you may need Constrained Delaunay Triangulation (otherwise some edges may not be included in the triangulation).
There is delaunayn function in geometry package for R language (see doc)
It takes an array of boundary points (as in your case) to create a Delaunay mesh on it.
You could also save your geometry into some well-known format, and use one of mesh generators.

how to subtract circle from an arbitrary polygon

Given an arbitary polygon with vertices stored in either clockwise/counterclockwise fashion (depicted as a black rectangle in the diagram), I need to be able to subtract an arbitrary number of circles (in red on the diagram) from that polygon. Removing a circle could possibly split the polygon into two seperate polygons (as depicted by the second line in the diagram).
I'm not sure where to start.
Example http://www.freeimagehosting.net/uploads/89a0276d9d.jpg
Warning: getting code to do this absolutely right is tricky. (Conceptually it's fine, but you can quickly get bogged down in numerical errors and edge cases.) You're basically asking for a 2D version of Constructive Solid Geometry. You might want to see if you can use an existing library written by an expert in computational geometry. There are some libraries here that will probably do what you want, but you'll have to choose a representation that suits you best and convert what you have into that representation.
Here's a freeware polygon clipping library (written in Delphi and C++) that does what you're asking: http://sourceforge.net/projects/polyclipping/

Resources