I have an area which has 5 keypoints and mapped meshing requires only 4 keypoints .so I have to discard one keypoint which does not lie on the periphery of the area. How can I do it via coding ?
The set of points, which belong to periphery, is called convex hull. There are different algorithms to obtain convex hull, for example:
* Jarvis's or gift wrapping algorithm (https://www.geeksforgeeks.org/convex-hull-set-1-jarviss-algorithm-or-wrapping/); //simplest
* simple divide and conquer algorithm (https://www.geeksforgeeks.org/convex-hull-simple-divide-conquer-algorithm/).
Looking into 11-12-13, it is close to line, therefore line simplification algorithms can be applied to reduce point set, for example, Douglas & Peucker algorithm (https://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm).
If goal is to simplify each complex shape to 4 point shape, special algorithms may exist. However, it is possible to obtain using combination: 1) get convex hull; 2) simplify shape (line) of convex hull. Visvalingam's algorithm considers enclosed area (https://www.jasondavies.com/simplify/), therefore it may be suitable for convex hull simplification to 4 points.