void MultisliceParameters::setBox(const Vector3R& minBox,
                                  const Vector3R& maxBox,
                                  Real deltaZ)
{
  mMinBox = minBox;
  mMaxBox = maxBox;

  setSize(maxBox.x() - minBox.x(), maxBox.y() - minBox.y());
  mDepth = maxBox.z() - minBox.z();
  mDeltaZ = deltaZ;

  if (mDeltaZ <= 0)
    AURORA_THROW(EInvalidParameter, "deltaZ must be positive");

  mMinBoxes.clear();
  Real z = minBox.z();
  const Real maxZ = maxBox.z();

  mMinBoxes.push_back(Vector3R(minBox.x(), minBox.y(), z));

  do
  {
    z += mDeltaZ;
    mMinBoxes.push_back(Vector3R(minBox.x(), minBox.y(), z));
  }
  while (z < maxZ);

  if (verbosity >= 2)
  {
    for (size_t i = 0; i < numSlices(); ++i)
    {
      std::cout << " slice " << i << " (z1 = " << zStart(i) << ", z2 = "
                << zEnd(i) << ")\n";
    }
  }

  if (verbosity >= 1)
    std::cout << "Number of Slices: " << numSlices() << std::endl;
}
Esempio n. 2
0
Camera::Camera(Real px, Real py, Real pz,
	Real dx, Real dy, Real dz,
	Real ux, Real uy, Real uz,
	Real foco,
	Real w, Real h,
	Real s) {

	position = Vector3R();
	position[0] = px; position[1] = py; position[2] = pz;

	direction = Vector3R();
	direction[0] = dx; direction[1] = dy; direction[2] = dz;
	direction.normalize();

	up = Vector3R();
	up[0] = ux; up[1] = uy; up[2] = uz;
	up.normalize();

	right = direction.cross(up);

	focolength = foco;
	width = w; height = h;
	step = s;
}
Esempio n. 3
0
  /// Calculate a bound box where the faces parallel to the x-y-plane are
  /// quadratic
  Vector3R maxQuadraticBoundingBox(Real scale = 1) const
  {
    // the center of the bounding box
    Vector3R center = R(0.5) * (mMinBoundingBox + mMaxBoundingBox);

    // the diagonal of the bounding box
    Vector3R diagonal = mMaxBoundingBox - mMinBoundingBox;

    // the greatest extension of the bounding box in the x-y-plane, this will
    // be the edge length of the square.
    Real maxExtension = std::max(diagonal.x(), diagonal.y());
    return Vector3R(center.x() + maxExtension * R(0.5) * scale,
                    center.y() + maxExtension * R(0.5) * scale,
                    mMaxBoundingBox.z());
  }