// NewHalfEdge creates a new half-edge starting at the given vertex and stores it in the structure.
NewHalfEdge creates a new half-edge starting at the given vertex and stores it in the structure.
// NewHalfEdge creates a new half - edge starting at the given vertex and stores it in the structure .
func (d *DCEL) NewHalfEdge(face *Face, vertex *Vertex, twin *HalfEdge) *HalfEdge {
	halfEdge := &HalfEdge{
		Face:   face,
		Target: vertex,
		Twin:   twin,
	}
	if face.HalfEdge != nil {
		halfEdge.Prev = face.HalfEdge.Prev
		if halfEdge.Prev != nil {
			halfEdge.Prev.Next = halfEdge
		}
		face.HalfEdge.Prev = halfEdge
		halfEdge.Next = face.HalfEdge
	}
	face.HalfEdge = halfEdge
	if vertex != nil && vertex.HalfEdge == nil {
		vertex.HalfEdge = halfEdge
	}
	d.HalfEdges = append(d.HalfEdges, halfEdge)
	return halfEdge
}
func ( d * DCEL ) NewHalfEdge ( face * Face , vertex * Vertex , twin * HalfEdge ) * HalfEdge { halfEdge := & HalfEdge { Face : face , Target : vertex , Twin : twin , } if face . HalfEdge != nil { halfEdge . Prev = face . HalfEdge . Prev if halfEdge . Prev != nil { halfEdge . Prev . Next = halfEdge } face . HalfEdge . Prev = halfEdge halfEdge . Next = face . HalfEdge } face . HalfEdge = halfEdge if vertex != nil && vertex . HalfEdge == nil { vertex . HalfEdge = halfEdge } d . HalfEdges = append ( d . HalfEdges , halfEdge ) return halfEdge }
NewHalfEdge creates a new half-edge starting at the given vertex and stores it in the structure.
NewHalfEdge creates a new half - edge starting at the given vertex and stores it in the structure .
// Link new half-edge to the one pointed by the face counter-clockwise // Set the new half-edge as the one pointed by the face // If the vertex is not yet linked with an edge, link to this one