Ang Lee, the Magician >> Projects >> Graphics >>Mesh  
       
 

Mesh - Part A

shortcut to PartB / PartC / CS6491project page

Abstract

A tool lets user create a mesh by dragging points. The data structure "corner table" is implemented here. The program identify every loop by coloring them in different colors. And the program prevent user creating invalid mesh by taking 'flip' 'overlap' into consideration.

 

Picture with 10 loops in different colors

 

Links :

PartA:
WriteUP-1 (How to draw different border in different colors)
WriteUP-2 (Walk along the border)
WriteUP-3 (Prevent flip and overlap)
Movie (10MB MP4/ Use quicktime player)
source code (in C++)
excutable (interface_description)

 

Goal

Break-down according to the P2 instruction

Start with a single triangle. Your code should maintain a Corner Table representation of a planar triangle mesh (you may set all vertices to have (x,y,z) coordinates and initially set z=0). Always, identify the border edges as those opposite to corners c for which c.o == -1 and draw them in green. Also paint larger green dots for all vertices and smaller green dots for mid-points of border edges. Shade all triangles in yellow and draw interior (non-border) edges in black.

The user should be able to click near any green vertex (even interior ones) and drag it to a new position. While doing so, all the triangles incident upon that moving vertex will be automatically updated. You should check that they all remain counterclockwise (no flip) and have non-zero area.
While doing so, all the triangles incident upon that moving vertex will be automatically updated.
You should check that they all remain counterclockwise (no flip) and have non-zero area.

If the user clicks on the mid-point of a border-edge ("gate") and drags it towards the outside, you create a new triangle.
If the user releases the mouse button away from other border vertices, then the tip-vertex of the new triangle is a new vertex that you add to the vertex table (C-operation).
If the user releases the tip-vertex near an existing border vertex, V, then this tip-vertex should be V. This operation may make a non-manifold vertex.
Do not let the moving tip run inside any existing triangle (prevent overlap),
nor to the wrong side of the gate (prevent a flip).
Make sure that after each operation the O table is restored. Create a mesh with a non-maniofld vertex and with more than one bounding loop.

Display a small blue dot to indicate the current corner, c. The dot should be inside the triangle of that corner and closer to the vertex of the corner than to other vertices. Initially, set c to 0 (corner 0).
As the user presses the n, p, o, l, or r, keys, set c to c.n, c.p, .co, c.l, or c.r.

 

 

 

 

Last update: 2005-09-27