You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
580 B
29 lines
580 B
#include "terrain/ygradient.h" |
|
|
|
namespace vtk { namespace noise { |
|
|
|
YGradient::YGradient() { |
|
mStart = 0.0; |
|
mEnd = 0.0; |
|
} |
|
|
|
YGradient::YGradient(const double& start, const double& end) { |
|
mStart = start; |
|
mEnd = end; |
|
} |
|
|
|
void YGradient::setStart(const double& start) { |
|
mStart = start; |
|
} |
|
|
|
void YGradient::setEnd(const double& end) { |
|
mEnd = end; |
|
} |
|
|
|
double YGradient::get3D(const double& x, const double& y, const double& z) { |
|
double factor = (y - mStart) / (mEnd - mStart); |
|
if (factor >= 1.0) return 1.0; |
|
else if (factor <= 0.0) return -1.0; |
|
return (factor * 2.0) - 1.0; |
|
} |
|
}}
|
|
|