Friday, April 15, 2016

2d - How to get a reflex edge on a non-convex mesh


I am trying to implement a convex decomposition and I need to find the convex vertex on a mesh. Is there a algorithm that I can use to find the convex vertex on a mesh.



Answer



Here is some code that I used.


private static boolean isReflex(Vector3f p0, Vector3f p, Vector3f p1) {
// TODO Auto-generated method stub
return right(p1,p0,p);
}



private static boolean right(Vector3f a, Vector3f b, Vector3f p) {
return Segment.getLocation(p,a,b) < 0;
}

public static float getLocation(Vector3f point, Vector3f linePoint1, Vector3f linePoint2) {
Vector3f l = Vector3f.add(linePoint2, linePoint1, null);
Vector3f p = Vector3f.sub(point, linePoint1, null);

return Vector3f.angle(l, p);
}

No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...