Get convex polygons from vertex - polygon

Im writing a game in XNA and Im working right now in the pathfinding of the AI.
In my map there are some circular obstacles and I would like to use the mesh navigation technique (http://udn.epicgames.com/Three/NavigationMeshReference.html) so previously I need to convert those obstacles in a set of convex polygons.
Something like this:
Ive been searching in google for long time but couldnt find how to do it. Any clue?
Thanks!

Is a Delaunay triangulation what you are looking for?

Related

Can I apply BABYLON textures and materials to vertices of a ground?

I'm new in babylon.js and trying to create a dynamic water surface.
I succeeded in creating waves on a flat surface (using a ground and updateVerticesData).
What i need now is doing reflections (thought about reflection textures) and refractions (tought about mirrors).
Both are done by babylon by using planes but my surface is not flat but dynamic.
Can I apply the correct reflections and refractions to the vertices or to the triangles componing my ground ?
Is it ok to do that in a realtime rendering ?
Thanks for any suggestions !
Forgive my lack of details and research.
I succeed by using Babylon.waterMaterial : https://www.babylonjs-playground.com/#1SLLOJ#481.
Indeed, using updateVerticesData and waterMaterial both is ok.

Split concave polygon in convex ones

Is there any easy algorithm to split a concave polygon in convex ones or represent a polygon by triangles. I know there is a Wikipedia entry on triangulation but this doesn't really help me. I know there already is a question on Stackoverflow, however this is not very helpful to me. I would appreciate any pseudocode (or real code in an understandable programming language) to break a concave polygon in convex ones or triangles. Btw, the algorithm should also work for convex polygons and not mess around with them.
Thanks for your help!
As proposed by the commenters, ear cutting (clipping) should be the most straight forward way to triangulate. To speed up the verifying process of an ear in practice one can employ a geometric grid.
To write robust and performant code, especially for geometric problems is very challenging. Why not use existing implementations like triangle or CGAL.
In order to use CGAL via python one could go for SWIG.

How do I draw a custom 3d surface using three.js?

What functions/math do I use to draw a 3d surface? For example, how do I generate z = sin(x+y)? How are the points calculated and drawn? I couldn't find any examples.
Following examples are linked from three.js website:
http://stemkoski.github.io/Three.js/Graphulus-Function.html
http://stemkoski.github.io/Three.js/Graphulus-Surface.html
both of these examples are using THREE.ParametricGeometry
https://threejs.org/docs/#api/en/geometries/PlaneGeometry
Something like this contains vertices. If a vertex consists of [x,y,z] you can apply your function there by looping through all the vertices.
http://aerotwist.com/tutorials/an-introduction-to-shaders-part-1/
this tutorial is an example how you can use shaders to do the same thing MUCH faster
I believe that this tutorial is a great starting point for all things realtime 3d:
http://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices/

Google Maps API v3 - circle sector

I would like to draw sector of circle on map defined by point, radius, startAngle and stopAngle. I found lots of exmaples but with polygons etc whitch was too complicated for my case.
Thanks for any help!
a Circle is an object with no defined sides. Only a radius and a center point.
You are required to use a polygon to build a semi circle as it is a two sied object
There is not always an easy way out in coding, and typicaly they are the bad ways to do things (unless your talking about somthing like JQ/Bootstrap)
Here is a fairly stright forware implementation
http://googlemaps.googlermania.com/google_maps_api_v3/en/draw-semi-circle.html
This was refered in this question
Google Maps Polygon Incorrectly Rendered
they even provide a working example for you to rip apart
http://maps.forum.nu/temp/gm_bearing.html

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.

Resources