# generate_cloud_points

Given a 2D triangle mesh, we could randomly generate cloud points that fill in the triangle mesh.

# Run

`python disp_mesh.py`

Or you could use command line arguments: `python disp_mesh.py -i data/socks.txt`

# Triangle Mesh

We provide three tirangle meshes: **bunny**, **armadillo** and **christmas socks**.

## Triangle mesh format

```
numPoints 100
0.1 0.2
....
numTriangles 200
0 1 2
....
```

# Implementation details

- Read the triangle mesh with
`read_obj.py`

- Find boundary edges using
`find_boundary.py`

- Generate random points
`p`

in the AABB of triangle mesh - Shoot a ray from
`p`

and count how many time the ray intersects with boundary edges - If the number of intersections is even, then the point
`p`

is outside the triangle mesh - Otherwise, the point
`p`

is inside the triangle mesh - If
`p`

is inside the triangle mesh, we add it into the final cloud points field (`ti.Vector.field`

)