示例#1
0
bool Simple_RGrid_geometry::
grid_coordinates( GsTLGridNode& ijk, const GsTLPoint& p ) const {
  GsTLPoint::difference_type translated = p - origin_;
  ijk[0] = GsTL::floor( translated.x() / float( cell_dims_.x() ) );
  ijk[1] = GsTL::floor( translated.y() / float( cell_dims_.y() ) );
  ijk[2] = GsTL::floor( translated.z() / float( cell_dims_.z() ) );

  return true;
}
bool Simple_RGrid_geometry::
grid_coordinates( GsTLGridNode& ijk, const GsTLPoint& p ) const {
  GsTLPoint::difference_type translated = p - origin_;

  GsTLCoord dx  = translated.x()*z_cos_angle_ + translated.y()*z_sin_angle_;
  GsTLCoord dy  = -1.0*translated.x()*z_sin_angle_ + translated.y()*z_cos_angle_;

  ijk[0] = GsTL::floor( dx / float( cell_dims_.x() ) );
  ijk[1] = GsTL::floor( dy / float( cell_dims_.y() ) );
  ijk[2] = GsTL::floor( translated.z() / float( cell_dims_.z() ) );

  /*
  ijk[0] = GsTL::floor( translated.x() / float( cell_dims_.x() ) );
  ijk[1] = GsTL::floor( translated.y() / float( cell_dims_.y() ) );
  ijk[2] = GsTL::floor( translated.z() / float( cell_dims_.z() ) );
  */
  return true;
}