21 std::vector<double> points;
25 double domainX = domainSize[0]*.5;
26 double domainY = domainSize[1]*.5;
27 double domainZ = domainSize[2]*.5;
32 for (
int k = 0; k < stop; k++) {
34 if (newPoly.
vertices[idx] > domainX || newPoly.
vertices[idx] < -domainX)
break;
35 if (newPoly.
vertices[idx+1] > domainY || newPoly.
vertices[idx+1] < -domainY)
break;
36 if (newPoly.
vertices[idx+2] > domainZ || newPoly.
vertices[idx+2] < -domainZ)
break;
53 for (
int j = 0; j < 6; j++) {
57 ntmp[0] = 0; ntmp[1] = 0; ntmp[2] = 1;
58 pttmp[0] = 0; pttmp[1] = 0; pttmp[2] = domainZ;
61 ntmp[0] = 0; ntmp[1] = 0; ntmp[2] = -1;
62 pttmp[0] = 0; pttmp[1] = 0; pttmp[2] = -domainZ;
65 ntmp[0] = 0; ntmp[1] = 1; ntmp[2] = 0;
66 pttmp[0] = 0; pttmp[1] = domainY; pttmp[2] = 0;
69 ntmp[0] = 0; ntmp[1] = -1; ntmp[2] = 0;
70 pttmp[0] = 0; pttmp[1] = -domainY; pttmp[2] = 0;
73 ntmp[0] = 1; ntmp[1] = 0; ntmp[2] = 0;
74 pttmp[0] = domainX; pttmp[1] = 0; pttmp[2] = 0;
77 ntmp[0] = -1; ntmp[1] = 0; ntmp[2] = 0;
78 pttmp[0] = -domainX; pttmp[1] = 0; pttmp[2] = 0;
91 int last = (nVertices-1)*3;
93 temp[0] = newPoly.
vertices[last] - pttmp[0];
94 temp[1] = newPoly.
vertices[last+1] - pttmp[1];
95 temp[2] = newPoly.
vertices[last+2] - pttmp[2];
102 for (
int i = 0; i < nVertices; i++) {
104 temp[0] = newPoly.
vertices[index] - pttmp[0];
105 temp[1] = newPoly.
vertices[index+1] - pttmp[1];
106 temp[2] = newPoly.
vertices[index+2] - pttmp[2];
114 points.push_back(newPoly.
vertices[index]);
115 points.push_back(newPoly.
vertices[index+1]);
116 points.push_back(newPoly.
vertices[index+2]);
120 if (currdist * prevdist < 0) {
128 * std::abs(prevdist)/(std::abs(currdist)+std::abs(prevdist));
131 * std::abs(prevdist)/(std::abs(currdist)+std::abs(prevdist));
134 * std::abs(prevdist)/(std::abs(currdist)+std::abs(prevdist));
135 points.push_back(temp[0]);
136 points.push_back(temp[1]);
137 points.push_back(temp[2]);
144 * std::abs(prevdist) / (std::abs(currdist)+std::abs(prevdist));
147 * std::abs(prevdist) / (std::abs(currdist)+std::abs(prevdist));
150 * std::abs(prevdist) / (std::abs(currdist)+std::abs(prevdist));
151 points.reserve(points.size()+3);
153 points.push_back(temp[0]);
154 points.push_back(temp[1]);
155 points.push_back(temp[2]);
159 int tmpIndex = (nNodes-1)*3;
160 points[tmpIndex] = points[tmpIndex - 3];
161 points[tmpIndex+1] = points[tmpIndex - 2];
162 points[tmpIndex+2] = points[tmpIndex - 1];
163 points[tmpIndex-3] = temp[0];
164 points[tmpIndex-2] = temp[1];
165 points[tmpIndex-1] = temp[2];
179 newPoly.
vertices =
new double[3*nNodes];
182 for (
int k = 0; k < nNodes; k++) {
184 newPoly.
vertices[idxx] = points[idxx];
185 newPoly.
vertices[idxx+1] = points[idxx+1];
186 newPoly.
vertices[idxx+2] = points[idxx+2];
209 if (
magnitude(temp[0], temp[1], temp[2]) < (2*
h)) {
211 if ( std::abs(std::abs(newPoly.
vertices[idx])-domainX) >
eps && std::abs(std::abs(newPoly.
vertices[idx+1])-domainY) >
eps && std::abs(std::abs(newPoly.
vertices[idx+2])-domainZ) >
eps ) {
214 for (
int j = i; j < nNodes-1 ; j++) {
223 int end = (nNodes-1)*3;
224 for (
int j = next; j < end; j += 3){
245 for (
int k = 0; k < temp; k++){
251 newPoly.
faces[0] = 1;
254 newPoly.
faces[1] = 1;
258 newPoly.
faces[2] = 1;
260 else if (newPoly.
vertices[idx+1] <= -domainY+
eps) {
261 newPoly.
faces[3] = 1;
265 newPoly.
faces[4] = 1;
267 else if (newPoly.
vertices[idx+2] <= -domainZ+
eps) {
268 newPoly.
faces[5] = 1;
281 for (
unsigned int i = 0; i < point.size(); i++) {
282 if (i != 0 && i % 3 == 0){
285 std::cout<<point[i]<<
" ";
287 std::cout<<std::endl;
T magnitude(T x, T y, T z)
T dotProduct(const T *A, const T *B)
bool domainTruncation(Poly &newPoly, double *domainSize)
void printPoints(std::vector< double > &point)