- if (myDx < Precision::Confusion()) {
- myError = "Box builder with dimensions :: Dx is null.";
- return false;
- } else if (myDy < Precision::Confusion()) {
- myError = "Box builder with dimensions :: Dy is null.";
- return false;
- } else if (myDz < Precision::Confusion()) {
- myError = "Box builder with dimensions :: Dz is null.";
+ if (myMethodType == MethodType::BOX_DIM) {
+ if (myDx < Precision::Confusion()) {
+ myError = "Box builder with dimensions :: Dx is null or negative.";
+ return false;
+ } else if (myDy < Precision::Confusion()) {
+ myError = "Box builder with dimensions :: Dy is null or negative.";
+ return false;
+ } else if (myDz < Precision::Confusion()) {
+ myError = "Box builder with dimensions :: Dz is null or negative.";
+ return false;
+ }
+ } else if (myMethodType == MethodType::BOX_POINTS) {
+ if (!myFirstPoint.get()) {
+ myError = "Box builder with points :: the first point is not valid.";
+ return false;
+ }
+ if (!mySecondPoint.get()) {
+ myError = "Box builder with points :: the second point is not valid.";
+ return false;
+ }
+ if (myFirstPoint->distance(mySecondPoint) < Precision::Confusion()) {
+ myError = "Box builder with points :: the distance between the two points is null.";
+ return false;
+ }
+ double aDiffX = myFirstPoint->x() - mySecondPoint->x();
+ double aDiffY = myFirstPoint->y() - mySecondPoint->y();
+ double aDiffZ = myFirstPoint->z() - mySecondPoint->z();
+ if (fabs(aDiffX) < Precision::Confusion() ||
+ fabs(aDiffY) < Precision::Confusion() ||
+ fabs(aDiffZ) < Precision::Confusion()) {
+ myError =
+ "Box builder with points :: the points belong both to one of the OXY, OYZ or OZX planes.";
+ return false;
+ }
+ } else {
+ myError = "Box builder :: Method not implemented.";