void PointSolver2::projectLines() { visibleLines.clear(); for (int lid=0; lid<model.size(); lid++) { ModelLine &line = model[lid]; ProjectedPoint P1, P2; projectLine (line.p1, line.p2, currentViewMatrix, projectionMatrix, P1.coord, P2.coord, P1.inCam, P2.inCam); LineSegment2D vLine (P1, P2, lid); computeProjectionJacobian ( position0, orientation0, line.p1, vLine.A.inCam, vLine.A.coord, projectionMatrix.matrix, vLine.A.jacobian); computeProjectionJacobian ( position0, orientation0, line.p2, vLine.B.inCam, vLine.B.coord, projectionMatrix.matrix, vLine.B.jacobian); visibleLines.push_back (vLine); } }
SbVec3f SbSphereSectionProjector::project(const SbVec2f &point) // //////////////////////////////////////////////////////////////////////// { SbVec3f result; SbLine workingLine = getWorkingLine(point); if (needSetup) setupTolerance(); SbVec3f planeIntersection; SbVec3f sphereIntersection, dontCare; SbBool hitSphere; // Depending on whether we are intersecting front or rear, we care // about different arguments returned from intersect if ( intersectFront ) hitSphere = sphere.intersect(workingLine, sphereIntersection, dontCare); else hitSphere = sphere.intersect(workingLine, dontCare, sphereIntersection); if (hitSphere) { // drop the sphere intersection onto the tolerance plane SbLine projectLine(sphereIntersection, sphereIntersection + planeDir); if (! tolPlane.intersect(projectLine, planeIntersection)) #ifdef DEBUG SoDebugError::post("SbSphereSectionProjector::project", "Couldn't intersect working line with plane"); #else /* Do nothing */; #endif } else if (! tolPlane.intersect(workingLine, planeIntersection)) #ifdef DEBUG SoDebugError::post("SbSphereSectionProjector::project", "Couldn't intersect working line with plane"); #else /* Do nothing */; #endif float dist = (planeIntersection - planePoint).length(); if (dist < tolDist) { #ifdef DEBUG if (! hitSphere) SoDebugError::post("SbSphereSectionProjector::project", "Couldn't intersect with sphere"); #endif result = sphereIntersection; } else { result = planeIntersection; } lastPoint = result; return result; }