Hi,
There is a small bug in on_surface function. Most of the people may not meet
this bug.
Unfortunately, I was troubled much with it. Here is the fix.
bool Plane::on_surface (const Point& p) const
{
// Create a vector from the surface to point p;
const Point w = p - _point;
// If the projection of that vector onto the
// plane's normal is 0 then the point is in
// the plane.
const Real proj = w*this->normal();
if ( std::abs(proj) < 1.e-10 )
return true;
return false;
}
An useful constructor of building sphere from 4 points. Will you please add
it to libmesh?
Sphere::Sphere (const Point& pa, const Point& pb, const Point& pc, const
Point& pd)
{
Point pad = pa - pd;
Point pbd = pb - pd;
Point pcd = pc - pd;
TensorValue<Real> T(pad,pbd,pcd);
// the det
Real D = T.det();
assert (std::abs(D) > 1e-12);
Real e = 0.5*(pa.size_sq() - pd.size_sq());
Real f = 0.5*(pb.size_sq() - pd.size_sq());
Real g = 0.5*(pc.size_sq() - pd.size_sq());
TensorValue<Real> T1(e,pad(1),pad(2),
f,pbd(1),pbd(2),
g,pcd(1),pcd(2));
Real sx = T1.det()/D;
TensorValue<Real> T2(pad(0),e,pad(2),
pbd(0),f,pbd(2),
pcd(0),g,pcd(2));
Real sy = T2.det()/D;
TensorValue<Real> T3(pad(0),pad(1),e,
pbd(0),pbd(1),f,
pcd(0),pcd(1),g);
Real sz = T3.det()/D;
Point c(sx,sy,sz);
Real r = (c-pa).size();
this->create_from_center_radius (c, r);
}
Gong Ding
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users