Subject: CGAL users discussion list
List archive
[cgal-discuss] Projecting vertex in the plane of a polyhedron at a border halfedge
Chronological Thread
- From: Priyank Jain <>
- To:
- Subject: [cgal-discuss] Projecting vertex in the plane of a polyhedron at a border halfedge
- Date: Tue, 19 Jan 2010 16:52:07 -0500
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=Ns4eQuErJzrZBsZ/NE3mLey3dtUYFgP5uWsmu1fOZQ5gZGDn1fK9+b7MEyCtF2E0Uv y3qOiU2CsxJobimdLyzKp0EMQ9m7242zmuk5RGreGIr4q3RJYIPF6JMTYKYO53mZL2RT buD/W4TuO+7Uzw/LY3eqcYazvlJZspuH4LZxM=
Hi,
I wrote this method to project a new vertex in the plane of the (polyhedron) model, border halfedge. I am not sure if this works 100%. I've tried with some cases and debugged through the code. It seems that it is working fine, but I want to be sure. If somebody may, can you please go through the code real quick and tell me if it looks 'ok' to you..
Here is the code:
Point_3 Project_NewVertex(Halfedge* p_halfEdge, Vertex& i_Vertex, Vertex& j_Vertex) {
double dist_Proj = 0.5;
Point_3& point1 = i_Vertex.point();
Point_3& point2 = j_Vertex.point();
Point_3& midPt = midpoint(point1, point2);
Plane_Equation pe;
//facet due to opposite halfedge since this one is linked to the infinite vertex and plane is not defined
Plane& plane = pe(*(p_halfEdge->opposite()->facet()) ); // plane returned that is associated with the inner facet
Vector3& normal = plane.opposite().orthogonal_vector(); // plane associated with the border halfedge, since the plane was calculated with its opposite halfedge
Vector3& direction = CGAL::cross_product( point1 - point2, normal ); // since we are going from ptJ to ptI => i - j
//std::cout << "\n i: " << point1.x() << " " << point1.y();
//std::cout << "\n j: " << point2.x() << " " << point2.y();
Normalize_Vector(direction);
Point_3& newPoint = midPt + (direction * dist_Proj);
//std::cout << "\n midPt: " << newPoint.x() << " " << newPoint.y();
return newPoint;
}
Please let me know what you feel about it.
Thanks a lot!
/Priyank
- [cgal-discuss] Projecting vertex in the plane of a polyhedron at a border halfedge, Priyank Jain, 01/19/2010
Archive powered by MHonArc 2.6.16.