## Calc::PointInConvexPolygon

**Defined in:**

`C4Computation.h`

Prototype

`int32 PointInConvexPolygon(const Point3D& p, int32 vertexCount, const Point3D *vertex, const Vector3D& normal);`

Parameters

`p` |
The point to test. |

`vertexCount` |
The number of vertices defining the boundary of the polygon. This must be at least 3. |

`vertex` |
An array containing the vertices of the polygon, wound in counterclockwise order. |

`normal` |
The normal direction of the polygon. |

Description

The `PointInConvexPolygon`

function determines the location of the point given by the `p`

parameter with respect to the polygon specified by the `vertexCount`

and `vertex`

parameters. The return value is one of the following constants.
`kPolygonInterior` |
The point lies in the interior of the polygon. |

`kPolygonBoundary` |
The point lies on or very near the boundary of the polygon. |

`kPolygonExterior` |
The point lies outside the polygon. |

`vertex`

parameter should point to an array of `Point3D`

objects of size given by the `vertexCount`

parameter. These vertices should be wound in counterclockwise order about the normal direction specified by the `normal`

parameter. The polygon must be convex and must lie in a plane that is perpendicular to the normal direction. If these requirements are not satisfied, then the result is undefined.
See Also