Skip to content

Commit

Permalink
Modified all C files to not depend on Iex.
Browse files Browse the repository at this point in the history
Signed-off-by: Owen Thompson <oxt3479@rit.edu>
  • Loading branch information
oxt3479 committed Jun 23, 2020
1 parent d2e92ec commit 279e160
Show file tree
Hide file tree
Showing 61 changed files with 334 additions and 426 deletions.
2 changes: 1 addition & 1 deletion Half/halfFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@

#include "half.h"

#include "IlmBaseConfig.h"
#include "ImathConfig.h"
#ifndef ILMBASE_HAVE_LARGE_STACK
#include <string.h> // need this for memset
#else
Expand Down
30 changes: 14 additions & 16 deletions Imath/ImathFrustum.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@
#include "ImathFun.h"
#include "ImathNamespace.h"

#include "IexMathExc.h"

IMATH_INTERNAL_NAMESPACE_HEADER_ENTER

//
Expand Down Expand Up @@ -304,7 +302,7 @@ template<class T>
void Frustum<T>::set(T nearPlane, T farPlane, T fovx, T fovy, T aspect)
{
if (fovx != 0 && fovy != 0)
throw IEX_NAMESPACE::ArgExc ("fovx and fovy cannot both be non-zero.");
throw std::domain_error ("fovx and fovy cannot both be non-zero.");

const T two = static_cast<T>(2);

Expand Down Expand Up @@ -348,7 +346,7 @@ T Frustum<T>::aspect() const
if (abs(topMinusBottom) < 1 &&
abs(rightMinusLeft) > limits<T>::max() * abs(topMinusBottom))
{
throw IEX_NAMESPACE::DivzeroExc ("Bad viewing frustum: "
throw std::domain_error ("Bad viewing frustum: "
"aspect ratio cannot be computed.");
}

Expand All @@ -374,7 +372,7 @@ Matrix44<T> Frustum<T>::projectionMatrix() const
(abs(farMinusNear) < 1 &&
abs(farPlusNear) > limits<T>::max() * abs(farMinusNear)))
{
throw IEX_NAMESPACE::DivzeroExc ("Bad viewing frustum: "
throw std::domain_error ("Bad viewing frustum: "
"projection matrix cannot be computed.");
}

Expand All @@ -391,7 +389,7 @@ Matrix44<T> Frustum<T>::projectionMatrix() const
(abs(farMinusNear) < 1 &&
2 > limits<T>::max() * abs(farMinusNear)))
{
throw IEX_NAMESPACE::DivzeroExc ("Bad viewing frustum: "
throw std::domain_error ("Bad viewing frustum: "
"projection matrix cannot be computed.");
}

Expand All @@ -414,7 +412,7 @@ Matrix44<T> Frustum<T>::projectionMatrix() const
if (abs(farMinusNear) < 1 &&
abs(farTimesNear) > limits<T>::max() * abs(farMinusNear))
{
throw IEX_NAMESPACE::DivzeroExc ("Bad viewing frustum: "
throw std::domain_error ("Bad viewing frustum: "
"projection matrix cannot be computed.");
}

Expand All @@ -427,7 +425,7 @@ Matrix44<T> Frustum<T>::projectionMatrix() const
(abs(topMinusBottom) < 1 &&
abs(twoTimesNear) > limits<T>::max() * abs(topMinusBottom)))
{
throw IEX_NAMESPACE::DivzeroExc ("Bad viewing frustum: "
throw std::domain_error ("Bad viewing frustum: "
"projection matrix cannot be computed.");
}

Expand Down Expand Up @@ -481,7 +479,7 @@ Vec2<T> Frustum<T>::localToScreen(const Vec2<T> &p) const
(abs(bottomMinusTop) < T (1) &&
abs(bottomPlusTop) > limits<T>::max() * abs(bottomMinusTop)))
{
throw IEX_NAMESPACE::DivzeroExc
throw std::domain_error
("Bad viewing frustum: "
"local-to-screen transformation cannot be computed");
}
Expand Down Expand Up @@ -518,7 +516,7 @@ T Frustum<T>::ZToDepth(long zval,long zmin,long zmax) const

if (zdiff == 0)
{
throw IEX_NAMESPACE::DivzeroExc
throw std::domain_error
("Bad call to Frustum::ZToDepth: zmax == zmin");
}

Expand All @@ -545,7 +543,7 @@ T Frustum<T>::normalizedZToDepth(T zval) const
if (abs(farMinusNear) < 1 &&
abs(farTimesNear) > limits<T>::max() * abs(farMinusNear))
{
throw IEX_NAMESPACE::DivzeroExc
throw std::domain_error
("Frustum::normalizedZToDepth cannot be computed. The "
"near and far clipping planes of the viewing frustum "
"may be too close to each other");
Expand All @@ -568,7 +566,7 @@ long Frustum<T>::DepthToZ(T depth,long zmin,long zmax) const
if (abs(farMinusNear) < 1 &&
abs(farPlusNear) > limits<T>::max() * abs(farMinusNear))
{
throw IEX_NAMESPACE::DivzeroExc
throw std::domain_error
("Bad viewing frustum: near and far clipping planes "
"are too close to each other");
}
Expand All @@ -584,7 +582,7 @@ long Frustum<T>::DepthToZ(T depth,long zmin,long zmax) const
if (abs(depth) < 1 &&
abs(farTimesNear) > limits<T>::max() * abs(depth))
{
throw IEX_NAMESPACE::DivzeroExc
throw std::domain_error
("Bad call to DepthToZ function: value of `depth' "
"is too small");
}
Expand All @@ -593,7 +591,7 @@ long Frustum<T>::DepthToZ(T depth,long zmin,long zmax) const
if (abs(farMinusNear) < 1 &&
abs(farPlusNear) > limits<T>::max() * abs(farMinusNear))
{
throw IEX_NAMESPACE::DivzeroExc
throw std::domain_error
("Bad viewing frustum: near and far clipping planes "
"are too close to each other");
}
Expand Down Expand Up @@ -622,7 +620,7 @@ T Frustum<T>::screenRadius(const Vec3<T> &p, T radius) const
}
else
{
throw IEX_NAMESPACE::DivzeroExc
throw std::domain_error
("Bad call to Frustum::screenRadius: the magnitude of `p' "
"is too small");
}
Expand All @@ -639,7 +637,7 @@ T Frustum<T>::worldRadius(const Vec3<T> &p, T radius) const
}
else
{
throw IEX_NAMESPACE::DivzeroExc
throw std::domain_error
("Bad viewing frustum: the near clipping plane is too "
"close to zero");
}
Expand Down
23 changes: 11 additions & 12 deletions Imath/ImathMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@

#include "ImathPlatform.h"
#include "ImathFun.h"
#include "ImathExc.h"
#include "ImathVec.h"
#include "ImathShear.h"
#include "ImathNamespace.h"
Expand Down Expand Up @@ -245,7 +244,7 @@ template <class T> class Matrix22
//------------------------------------------------------------
// Inverse matrix: If singExc is false, inverting a singular
// matrix produces an identity matrix. If singExc is true,
// inverting a singular matrix throws a SingMatrixExc.
// inverting a singular matrix throws std::invalid_argument.
//
// inverse() and invert() invert matrices using determinants.
//
Expand Down Expand Up @@ -527,7 +526,7 @@ template <class T> class Matrix33
//------------------------------------------------------------
// Inverse matrix: If singExc is false, inverting a singular
// matrix produces an identity matrix. If singExc is true,
// inverting a singular matrix throws a SingMatrixExc.
// inverting a singular matrix throws a std::invalid_argument.
//
// inverse() and invert() invert matrices using determinants;
// gjInverse() and gjInvert() use the Gauss-Jordan method.
Expand Down Expand Up @@ -902,7 +901,7 @@ template <class T> class Matrix44
//------------------------------------------------------------
// Inverse matrix: If singExc is false, inverting a singular
// matrix produces an identity matrix. If singExc is true,
// inverting a singular matrix throws a SingMatrixExc.
// inverting a singular matrix throws a std::invalid_argument.
//
// inverse() and invert() invert matrices using determinants;
// gjInverse() and gjInvert() use the Gauss-Jordan method.
Expand Down Expand Up @@ -1625,7 +1624,7 @@ Matrix22<T>::inverse (bool singExc) const
else
{
if (singExc)
throw SingMatrixExc ("Cannot invert "
throw std::invalid_argument ("Cannot invert "
"singular matrix.");
return Matrix22();
}
Expand Down Expand Up @@ -2308,7 +2307,7 @@ Matrix33<T>::gjInverse (bool singExc) const
if (pivotsize == 0)
{
if (singExc)
throw ::IMATH_INTERNAL_NAMESPACE::SingMatrixExc ("Cannot invert singular matrix.");
throw std::invalid_argument ("Cannot invert singular matrix.");

return Matrix33();
}
Expand Down Expand Up @@ -2350,7 +2349,7 @@ Matrix33<T>::gjInverse (bool singExc) const
if ((f = t[i][i]) == 0)
{
if (singExc)
throw ::IMATH_INTERNAL_NAMESPACE::SingMatrixExc ("Cannot invert singular matrix.");
throw std::invalid_argument ("Cannot invert singular matrix.");

return Matrix33();
}
Expand Down Expand Up @@ -2429,7 +2428,7 @@ Matrix33<T>::inverse (bool singExc) const
else
{
if (singExc)
throw SingMatrixExc ("Cannot invert "
throw std::invalid_argument ("Cannot invert "
"singular matrix.");
return Matrix33();
}
Expand Down Expand Up @@ -2480,7 +2479,7 @@ Matrix33<T>::inverse (bool singExc) const
else
{
if (singExc)
throw SingMatrixExc ("Cannot invert "
throw std::invalid_argument ("Cannot invert "
"singular matrix.");
return Matrix33();
}
Expand Down Expand Up @@ -3577,7 +3576,7 @@ Matrix44<T>::gjInverse (bool singExc) const
if (pivotsize == 0)
{
if (singExc)
throw ::IMATH_INTERNAL_NAMESPACE::SingMatrixExc ("Cannot invert singular matrix.");
throw std::invalid_argument ("Cannot invert singular matrix.");

return Matrix44();
}
Expand Down Expand Up @@ -3619,7 +3618,7 @@ Matrix44<T>::gjInverse (bool singExc) const
if ((f = t[i][i]) == 0)
{
if (singExc)
throw ::IMATH_INTERNAL_NAMESPACE::SingMatrixExc ("Cannot invert singular matrix.");
throw std::invalid_argument ("Cannot invert singular matrix.");

return Matrix44();
}
Expand Down Expand Up @@ -3707,7 +3706,7 @@ Matrix44<T>::inverse (bool singExc) const
else
{
if (singExc)
throw SingMatrixExc ("Cannot invert singular matrix.");
throw std::invalid_argument ("Cannot invert singular matrix.");

return Matrix44();
}
Expand Down
7 changes: 3 additions & 4 deletions Imath/ImathMatrixAlgo.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
#include "ImathMatrix.h"
#include "ImathQuat.h"
#include "ImathEuler.h"
#include "ImathExc.h"
#include "ImathVec.h"
#include "ImathLimits.h"
#include "ImathNamespace.h"
Expand Down Expand Up @@ -84,7 +83,7 @@ IMATH_EXPORT_CONST M44d identity44d;
// that determines the functions' behavior when the matrix'
// scaling is very close to zero:
//
// If exc is true, the functions throw an Imath::ZeroScale exception.
// If exc is true, the functions throw a std::domain_error exception.
//
// If exc is false:
//
Expand Down Expand Up @@ -798,7 +797,7 @@ checkForZeroScaleInRow (const T& scl,
if ((abs (scl) < 1 && abs (row[i]) >= limits<T>::max() * abs (scl)))
{
if (exc)
throw IMATH_INTERNAL_NAMESPACE::ZeroScaleExc ("Cannot remove zero scaling "
throw std::domain_error ("Cannot remove zero scaling "
"from matrix.");
else
return false;
Expand Down Expand Up @@ -1315,7 +1314,7 @@ checkForZeroScaleInRow (const T& scl,
if ((abs (scl) < 1 && abs (row[i]) >= limits<T>::max() * abs (scl)))
{
if (exc)
throw IMATH_INTERNAL_NAMESPACE::ZeroScaleExc (
throw std::domain_error (
"Cannot remove zero scaling from matrix.");
else
return false;
Expand Down
2 changes: 1 addition & 1 deletion Imath/ImathNamespace.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
// Open Source version of this file pulls in the IlmBaseConfig.h file
// for the configure time options.
//
#include "IlmBaseConfig.h"
#include "ImathConfig.h"


#ifndef IMATH_NAMESPACE
Expand Down
1 change: 0 additions & 1 deletion Imath/ImathQuat.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
//
//----------------------------------------------------------------------

#include "ImathExc.h"
#include "ImathMatrix.h"
#include "ImathNamespace.h"

Expand Down
1 change: 0 additions & 1 deletion Imath/ImathShear.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
//
//----------------------------------------------------

#include "ImathExc.h"
#include "ImathLimits.h"
#include "ImathMath.h"
#include "ImathVec.h"
Expand Down
Loading

0 comments on commit 279e160

Please sign in to comment.