added invariants check for a constructed half mesh

also fixed a bug in the generation of the half mesh
half edges for the boundary