I'm not sure exactly how zeq did it in his cog, but lets say you are trying to find if a vertex is on a sector's surface or not (if you are talking about a generic surface that isn't a part of the level geometry then there is a bit more to do)

First off, if a vertex is on the surface, it's also on the plane the surface lies in, so find whether they are in the same plane or not first. You'll need the surface normal and a point on the surface (lets say the first vertex, or any other), which you can get through a couple cog verbs.

planedist = VectorDot(normal, vertex);

pointdist = VectorDot(normal, testpoint);

if pointdist < planedist, then testpoint is behind the plane (and also outside of the sector)

if pointdist > planedist, then testpoint is in front of the surface (not necessarily inside the sector)

if pointdist is equal to planedist, then it is on the plane with the surface....now you have to be careful because of floating point precision and other things, so you should actually do it like this:

planedist = VectorDot(normal, vertex);

pointdist = VectorDot(normal, testpoint);

dist = pointdist - planedist;

if (dist > -.0001 && dist < .0001)

{

// point is on the plane

}

else if (dist > 0)

{

// point is in front of the surface

}

else

{

// point is behind the surface

}

what you should do is, first check if the point is on the surface in question. If it's not, then it's not on the surface, but if it is, you then need to check to see if the point is in front of or on the other planes for every other surface in the sector. If so, then the point is on the surface.

This avoids using trig functions by taking advantage of convex sectors, if the point is on the surface's plane and also inside/on edge with all of the other surface planes then it must be on the surface.

If you are actually talking about finding if a point is on some generic convex surface (not the surface of a sector) then the second part is different.

Oh, and actually this can be done easier if you already know the point is inside the sector, or if you can call a function from your cog to see if the point is inside the sector (I forgot if you can do that). If you know the point is inside the sector, then you just need to do the first part where you check if it's on the surface's plane. The second part is just checking to see if the point is also inside the sector.