mcneel / rhino3dm

Libraries based on OpenNURBS with a RhinoCommon style
MIT License
574 stars 135 forks source link

BND_Box::PointAt returns incorrect values #556

Closed fraguada closed 10 months ago

fraguada commented 11 months ago

In a box with min -10,-10,0 and max 10,10,20, BND_Box::PointAt(0,0,0) should return -10,-10,0, but instead returns 0,0,0.

RhinoCommon uses:

//.../rhinocommon/dotnet/opennurbs/opennurbs_box.cs
public Point3d PointAt(double x, double y, double z)
{

  x = m_dx.ParameterAt(x);
  y = m_dy.ParameterAt(y);
  z = m_dz.ParameterAt(z);

  return m_plane.PointAt(x, y, z);
}

//...
//.../rhinocommon/dotnet/opennurbs/opennurbs_plane.cs
public Point3d PointAt(double u, double v)
{
  return (Origin + u * XAxis + v * YAxis);
}

js/py bindings use:

//src/lib/opennurbs/opennurbs_box.cpp
ON_3dPoint ON_Box::PointAt( 
        double r, 
        double s, 
        double t 
        ) const
{
  // Do not validate - it is too slow.
  return plane.PointAt(r,s,t);
}

//...
//src/lib/opennurbs/opennurbs_plane.cpp
ON_3dPoint ON_Plane::PointAt( double s, double t, double c ) const
{
  return (origin + s*xaxis + t*yaxis + c*zaxis);
}