BRL-CAD
dsp_brep.cpp
Go to the documentation of this file.
1 /* D S P _ B R E P . C P P
2  * BRL-CAD
3  *
4  * Copyright (c) 2008-2014 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 /** @file dsp_brep.cpp
21  *
22  * Convert a Displacement Map to b-rep form
23  *
24  */
25 
26 #include "common.h"
27 
28 #include "raytrace.h"
29 #include "rtgeom.h"
30 #include "brep.h"
31 
32 /* private header */
33 #include "./dsp.h"
34 
35 #define MOVEPT(_p) MAT4X3PNT(_p, dsp_ip->dsp_stom, p_temp)
36 #define MAX_CNT 256
37 
38 fastf_t C[2*MAX_CNT+1][2*MAX_CNT+1]; // Combination. Assume xcnt & ycnt are not greater than 256
39 
40 int DegreeReduction(int n, ON_3dPointArray &bezcurv, fastf_t tol, fastf_t &maxerr)
41 {
42  /* This function reduces the degree of a Bezier curve by one.
43  * For details about the algorithm, see:
44  * Dave Morgan, Degree Reduction of Bezier Curves.
45  * http://www.yamnuska.ca/geek/degreeReductionBezier.pdf
46  * NOTE: This may cause quite inaccurate results, especially in the middle
47  * of the curve when n is big.
48  * TODO: Find a better algorithm unless this one is good enough.
49  */
50 
51  if (tol < 0.0)
52  return -1;
53  if (bezcurv.Count() != n + 1) {
54  bu_log("DegreeReduction(): The Bezier curve should has %d control points!\n", n + 1);
55  return -2;
56  }
57  if (n < 1)
58  return -2;
59 
60  ON_3dPointArray left(n), right(n), tmpcurve(n);
61  left[0] = bezcurv[0];
62  for (int i = 1; i < n; i++) {
63  left[i] = bezcurv[i] + (double)i / (n - i) * (bezcurv[i] - left[i - 1]);
64  }
65  right[n - 1] = bezcurv[n];
66  for (int i = n - 1; i > 0; i--) {
67  right[i - 1] = bezcurv[i] + (double)(n - i) / i * (bezcurv[i] - right[i]);
68  }
69 
70  fastf_t sum = 0.0;
71  for (int i = 0; i < n; i++) {
72  ON_3dPoint newpt;
73  fastf_t lambda = pow(2.0, 1 - 2*n);
74  sum += C[2*n][2*i];
75  lambda *= sum;
76  if (NEAR_ZERO(lambda, 1e-6))
77  lambda = 0.0;
78  if (NEAR_EQUAL(lambda, 1.0, 1e-6))
79  lambda = 1.0;
80  newpt = (1 - lambda) * left[i] + lambda * right[i];
81  tmpcurve.Append(newpt);
82  }
83  // Calculate the deviation
84  int r = (n - 1) / 2;
85  if (n % 2 == 0) {
86  ON_3dVector delta;
87  delta = bezcurv[r + 1] - (tmpcurve[r] + tmpcurve[r + 1]) / 2;
88  maxerr += delta.Length();
89  } else {
90  ON_3dVector delta;
91  delta = left[r] - right[r];
92  maxerr += delta.Length();
93  }
94 
95  if (maxerr > tol)
96  return -1;
97 
98  bezcurv.Empty();
99  bezcurv.Append(tmpcurve.Count(), tmpcurve.Array());
100  return 0;
101 }
102 
103 extern "C" void
104 rt_dsp_brep(ON_Brep **b, const struct rt_db_internal *ip, const struct bn_tol *)
105 {
106  struct rt_dsp_internal *dsp_ip;
107 
108  if (!b)
109  return;
110 
111  RT_CK_DB_INTERNAL(ip);
112  dsp_ip = (struct rt_dsp_internal *)ip->idb_ptr;
113  RT_DSP_CK_MAGIC(dsp_ip);
114 
115  /* A DSP brep is broken down into faces as follows:
116  *
117  * 1. The bottom face, a simple planar surface
118  *
119  * 2. The four sides, again planar faces but with one edge being
120  * trimmed by a curve describing the cross section of the DSP
121  * surface with the plane of the face.
122  *
123  * 3. The top surface - a generalized Bezier surface with
124  * boundaries equal to those of the four side surface intersection
125  * curves. Surface topology is deduced as a function of the height
126  * values.
127  */
128 
129  // Step 1 - create the bottom face.
130 
131  point_t p_origin, p2, p3;
132  point_t p_temp;
133  ON_3dPoint plane_origin, plane_x_dir, plane_y_dir, pt2, pt3, pt4;
134 
135  VSETALL(p_temp, 0.0);
136  MOVEPT(p_origin);
137  plane_origin = ON_3dPoint(p_origin);
138 
139  VSET(p_temp, dsp_ip->dsp_xcnt-1, 0, 0);
140  MOVEPT(p2);
141  plane_x_dir = ON_3dPoint(p2);
142 
143  VSET(p_temp, 0, dsp_ip->dsp_ycnt-1, 0);
144  MOVEPT(p3);
145  plane_y_dir = ON_3dPoint(p3);
146 
147  ON_Plane bottom_plane(plane_origin, plane_x_dir, plane_y_dir);
148  ON_PlaneSurface bottom_surf(bottom_plane);
149  bottom_surf.SetDomain(0, 0.0, DIST_PT_PT(p_origin, p2));
150  bottom_surf.SetDomain(1, 0.0, DIST_PT_PT(p_origin, p3));
151  bottom_surf.SetExtents(0, bottom_surf.Domain(0));
152  bottom_surf.SetExtents(1, bottom_surf.Domain(1));
153  ON_BrepFace *bottomface = (*b)->NewFace(bottom_surf);
154  (*b)->FlipFace(*bottomface);
155 
156  // Second step, the "walls"
157 
158  ON_SimpleArray<ON_Curve *> boundary;
159 
160  // side 1
161 
162  point_t s1p1, s1p2, s1p3, s1p4;
163  ON_3dPoint s1pt1, s1pt2, s1pt3, s1pt4;
164  ON_3dPointArray bezpoints1(256);
165 
166  VSET(p_temp, 0, 0, 0);
167  MOVEPT(s1p1);
168  VSET(p_temp, dsp_ip->dsp_xcnt - 1, 0, 0);
169  MOVEPT(s1p2);
170  VSET(p_temp, dsp_ip->dsp_xcnt - 1, 0, DSP(dsp_ip, dsp_ip->dsp_xcnt-1, 0));
171  MOVEPT(s1p3);
172  VSET(p_temp, 0, 0, DSP(dsp_ip, 0 , 0));
173  MOVEPT(s1p4);
174  s1pt1 = ON_3dPoint(s1p1);
175  s1pt2 = ON_3dPoint(s1p2);
176  s1pt3 = ON_3dPoint(s1p3);
177  s1pt4 = ON_3dPoint(s1p4);
178  ON_Plane s1_plane(s1pt1, s1pt2, s1pt4);
179  ON_PlaneSurface *s1_surf = new ON_PlaneSurface(s1_plane);
180  // Need 3 linear curves and a spline curve
181  ON_Curve *s1c1 = new ON_LineCurve(s1pt1, s1pt2);
182  boundary.Append(s1c1);
183  ON_Curve *s1c2 = new ON_LineCurve(s1pt2, s1pt3);
184  boundary.Append(s1c2);
185  for (int x=(dsp_ip->dsp_xcnt - 1); x >= 0; x--) {
186  point_t p_ctrl;
187  VSET(p_temp, x, 0, DSP(dsp_ip, x, 0));
188  MOVEPT(p_ctrl);
189  ON_3dPoint *ctrlpt = new ON_3dPoint(p_ctrl);
190  bezpoints1.Append(*ctrlpt);
191  }
192  ON_BezierCurve s1_bez3d((const ON_3dPointArray)bezpoints1);
193  ON_NurbsCurve* s1_beznurb3d = ON_NurbsCurve::New();
194  s1_bez3d.GetNurbForm(*s1_beznurb3d);
195  s1_beznurb3d->SetDomain(0.0, 1.0);
196  boundary.Append(s1_beznurb3d);
197  ON_Curve *s1c4 = new ON_LineCurve(s1pt4, s1pt1);
198  boundary.Append(s1c4);
199  const int bsi1 = (*b)->AddSurface(s1_surf);
200  ON_BrepFace& s1f = (*b)->NewFace(bsi1);
201  (*b)->NewPlanarFaceLoop(s1f.m_face_index, ON_BrepLoop::outer, boundary, true);
202  const ON_BrepLoop* bloop1 = (*b)->m_L.Last();
203  s1_surf->SetDomain(0, bloop1->m_pbox.m_min.x, bloop1->m_pbox.m_max.x);
204  s1_surf->SetDomain(1, bloop1->m_pbox.m_min.y, bloop1->m_pbox.m_max.y);
205  s1_surf->SetExtents(0, s1_surf->Domain(0));
206  s1_surf->SetExtents(1, s1_surf->Domain(1));
207  (*b)->SetTrimIsoFlags(s1f);
208 
209  // side 2
210 
211  point_t s2p1, s2p2, s2p3, s2p4;
212  ON_3dPoint s2pt1, s2pt2, s2pt3, s2pt4;
213  ON_3dPointArray bezpoints2(256);
214 
215  boundary.Empty();
216  VSET(p_temp, 0, 0, 0);
217  MOVEPT(s2p1);
218  VSET(p_temp, 0, dsp_ip->dsp_ycnt - 1, 0);
219  MOVEPT(s2p2);
220  VSET(p_temp, 0, dsp_ip->dsp_ycnt - 1, DSP(dsp_ip, 0, dsp_ip->dsp_ycnt-1));
221  MOVEPT(s2p3);
222  VSET(p_temp, 0, 0, DSP(dsp_ip, 0 , 0));
223  MOVEPT(s2p4);
224  s2pt1 = ON_3dPoint(s2p1);
225  s2pt2 = ON_3dPoint(s2p2);
226  s2pt3 = ON_3dPoint(s2p3);
227  s2pt4 = ON_3dPoint(s2p4);
228  ON_Plane s2_plane(s2pt1, s2pt2, s2pt4);
229  ON_PlaneSurface *s2_surf = new ON_PlaneSurface(s2_plane);
230  // Need 3 linear curves and a spline curve
231  ON_Curve *s2c1 = new ON_LineCurve(s2pt1, s2pt2);
232  boundary.Append(s2c1);
233  ON_Curve *s2c2 = new ON_LineCurve(s2pt2, s2pt3);
234  boundary.Append(s2c2);
235  for (int y=(dsp_ip->dsp_ycnt - 1); y >= 0; y--) {
236  point_t p_ctrl;
237  VSET(p_temp, 0, y, DSP(dsp_ip, 0, y));
238  MOVEPT(p_ctrl);
239  ON_3dPoint ctrlpt(p_ctrl);
240  bezpoints2.Append(ctrlpt);
241  }
242  ON_BezierCurve s2_bez3d((const ON_3dPointArray)bezpoints2);
243  ON_NurbsCurve* s2_beznurb3d = ON_NurbsCurve::New();
244  s2_bez3d.GetNurbForm(*s2_beznurb3d);
245  s2_beznurb3d->SetDomain(0.0, 1.0);
246  boundary.Append(s2_beznurb3d);
247  ON_Curve *s2c4 = new ON_LineCurve(s2pt4, s2pt1);
248  boundary.Append(s2c4);
249  const int bsi2 = (*b)->AddSurface(s2_surf);
250  ON_BrepFace& s2f = (*b)->NewFace(bsi2);
251  (*b)->NewPlanarFaceLoop(s2f.m_face_index, ON_BrepLoop::outer, boundary, true);
252  const ON_BrepLoop* bloop2 = (*b)->m_L.Last();
253  s2_surf->SetDomain(0, bloop2->m_pbox.m_min.x, bloop2->m_pbox.m_max.x);
254  s2_surf->SetDomain(1, bloop2->m_pbox.m_min.y, bloop2->m_pbox.m_max.y);
255  s2_surf->SetExtents(0, s2_surf->Domain(0));
256  s2_surf->SetExtents(1, s2_surf->Domain(1));
257  (*b)->SetTrimIsoFlags(s2f);
258  (*b)->FlipFace(s2f);
259 
260  // side 3
261 
262  point_t s3p1, s3p2, s3p3, s3p4;
263  ON_3dPoint s3pt1, s3pt2, s3pt3, s3pt4;
264  ON_3dPointArray bezpoints3(256);
265 
266  boundary.Empty();
267  VSET(p_temp, dsp_ip->dsp_xcnt - 1, dsp_ip->dsp_ycnt - 1, 0);
268  MOVEPT(s3p1);
269  VSET(p_temp, 0, dsp_ip->dsp_ycnt - 1, 0);
270  MOVEPT(s3p2);
271  VSET(p_temp, 0, dsp_ip->dsp_ycnt - 1, DSP(dsp_ip, 0, dsp_ip->dsp_ycnt-1));
272  MOVEPT(s3p3);
273  VSET(p_temp, dsp_ip->dsp_xcnt - 1, dsp_ip->dsp_ycnt - 1, DSP(dsp_ip, dsp_ip->dsp_xcnt-1, dsp_ip->dsp_ycnt-1));
274  MOVEPT(s3p4);
275  s3pt1 = ON_3dPoint(s3p1);
276  s3pt2 = ON_3dPoint(s3p2);
277  s3pt3 = ON_3dPoint(s3p3);
278  s3pt4 = ON_3dPoint(s3p4);
279  ON_Plane s3_plane(s3pt1, s3pt2, s3pt4);
280  ON_PlaneSurface *s3_surf = new ON_PlaneSurface(s3_plane);
281  // Need 3 linear curves and a spline curve
282  ON_Curve *s3c1 = new ON_LineCurve(s3pt1, s3pt2);
283  boundary.Append(s3c1);
284  ON_Curve *s3c2 = new ON_LineCurve(s3pt2, s3pt3);
285  boundary.Append(s3c2);
286  for (unsigned int x = 0; x < (dsp_ip->dsp_xcnt); x++) {
287  point_t p_ctrl;
288  VSET(p_temp, x, dsp_ip->dsp_ycnt - 1, DSP(dsp_ip, x, dsp_ip->dsp_ycnt - 1));
289  MOVEPT(p_ctrl);
290  ON_3dPoint ctrlpt(p_ctrl);
291  bezpoints3.Append(ctrlpt);
292  }
293  ON_BezierCurve s3_bez3d((const ON_3dPointArray)bezpoints3);
294  ON_NurbsCurve* s3_beznurb3d = ON_NurbsCurve::New();
295  s3_bez3d.GetNurbForm(*s3_beznurb3d);
296  s3_beznurb3d->SetDomain(0.0, 1.0);
297  boundary.Append(s3_beznurb3d);
298  ON_Curve *s3c4 = new ON_LineCurve(s3pt4, s3pt1);
299  boundary.Append(s3c4);
300  const int bsi3 = (*b)->AddSurface(s3_surf);
301  ON_BrepFace& s3f = (*b)->NewFace(bsi3);
302  (*b)->NewPlanarFaceLoop(s3f.m_face_index, ON_BrepLoop::outer, boundary, true);
303  const ON_BrepLoop* bloop3 = (*b)->m_L.Last();
304  s3_surf->SetDomain(0, bloop3->m_pbox.m_min.x, bloop3->m_pbox.m_max.x);
305  s3_surf->SetDomain(1, bloop3->m_pbox.m_min.y, bloop3->m_pbox.m_max.y);
306  s3_surf->SetExtents(0, s3_surf->Domain(0));
307  s3_surf->SetExtents(1, s3_surf->Domain(1));
308  (*b)->SetTrimIsoFlags(s3f);
309 
310  // side 4
311 
312  point_t s4p1, s4p2, s4p3, s4p4;
313  ON_3dPoint s4pt1, s4pt2, s4pt3, s4pt4;
314  ON_3dPointArray bezpoints4(256);
315 
316  boundary.Empty();
317  VSET(p_temp, dsp_ip->dsp_xcnt - 1, dsp_ip->dsp_ycnt - 1, 0);
318  MOVEPT(s4p1);
319  VSET(p_temp, dsp_ip->dsp_xcnt - 1, 0, 0);
320  MOVEPT(s4p2);
321  VSET(p_temp, dsp_ip->dsp_xcnt - 1, 0, DSP(dsp_ip, dsp_ip->dsp_xcnt-1, 0));
322  MOVEPT(s4p3);
323  VSET(p_temp, dsp_ip->dsp_xcnt - 1, dsp_ip->dsp_ycnt - 1, DSP(dsp_ip, dsp_ip->dsp_xcnt-1, dsp_ip->dsp_ycnt-1));
324  MOVEPT(s4p4);
325  s4pt1 = ON_3dPoint(s4p1);
326  s4pt2 = ON_3dPoint(s4p2);
327  s4pt3 = ON_3dPoint(s4p3);
328  s4pt4 = ON_3dPoint(s4p4);
329  ON_Plane s4_plane(s4pt1, s4pt2, s4pt4);
330  ON_PlaneSurface *s4_surf = new ON_PlaneSurface(s4_plane);
331  // Need 3 linear curves and a spline curve
332  ON_Curve *s4c1 = new ON_LineCurve(s4pt1, s4pt2);
333  boundary.Append(s4c1);
334  ON_Curve *s4c2 = new ON_LineCurve(s4pt2, s4pt3);
335  boundary.Append(s4c2);
336  for (unsigned int y=0; y < (dsp_ip->dsp_ycnt); y++) {
337  point_t p_ctrl;
338  VSET(p_temp, dsp_ip->dsp_xcnt - 1, y, DSP(dsp_ip, dsp_ip->dsp_xcnt - 1, y));
339  MOVEPT(p_ctrl);
340  ON_3dPoint ctrlpt(p_ctrl);
341  bezpoints4.Append(ctrlpt);
342  }
343  ON_BezierCurve s4_bez3d((const ON_3dPointArray)bezpoints4);
344  ON_NurbsCurve* s4_beznurb3d = ON_NurbsCurve::New();
345  s4_bez3d.GetNurbForm(*s4_beznurb3d);
346  s4_beznurb3d->SetDomain(0.0, 1.0);
347  boundary.Append(s4_beznurb3d);
348  ON_Curve *s4c4 = new ON_LineCurve(s4pt4, s4pt1);
349  boundary.Append(s4c4);
350  const int bsi4 = (*b)->AddSurface(s4_surf);
351  ON_BrepFace& s4f = (*b)->NewFace(bsi4);
352  (*b)->NewPlanarFaceLoop(s4f.m_face_index, ON_BrepLoop::outer, boundary, true);
353  const ON_BrepLoop* bloop4 = (*b)->m_L.Last();
354  s4_surf->SetDomain(0, bloop4->m_pbox.m_min.x, bloop4->m_pbox.m_max.x);
355  s4_surf->SetDomain(1, bloop4->m_pbox.m_min.y, bloop4->m_pbox.m_max.y);
356  s4_surf->SetExtents(0, s4_surf->Domain(0));
357  s4_surf->SetExtents(1, s4_surf->Domain(1));
358  (*b)->SetTrimIsoFlags(s4f);
359  (*b)->FlipFace(s4f);
360 
361  // Next, define the top face with full resolution.
362 
363  ON_BezierSurface *bezsurf = new ON_BezierSurface(3, false, dsp_ip->dsp_xcnt, dsp_ip->dsp_ycnt);
364 
365  for (unsigned int y=0; y < (dsp_ip->dsp_ycnt); y++) {
366  for (unsigned int x=0; x < (dsp_ip->dsp_xcnt); x++) {
367  point_t p_ctrl;
368  VSET(p_temp, x, y, DSP(dsp_ip, x, y));
369  MOVEPT(p_ctrl);
370  ON_3dPoint *ctrlpt = new ON_3dPoint(p_ctrl);
371  bezsurf->SetCV(x, y, *ctrlpt);
372  }
373  }
374 
375  // Reduce the top surface
376  fastf_t min = DSP(dsp_ip, 0, 0), max = DSP(dsp_ip, 0, 0);
377  for (unsigned int x = 0; x < dsp_ip->dsp_xcnt; x++) {
378  for (unsigned int y = 0; y < dsp_ip->dsp_ycnt; y++) {
379  fastf_t data = DSP(dsp_ip, x, y);
380  if (data > max)
381  max = data;
382  if (data < min)
383  min = data;
384  }
385  }
386  fastf_t max_delta = max - min;
387  fastf_t tol = max_delta * 5.0 * dsp_ip->dsp_ycnt;
388  fastf_t maxerr = 0.0;
389  // Calculate the combinations
390  C[0][0] = 1;
391  for (int i = 1; i <= MAX_CNT*2; i++) {
392  C[i][0] = C[i][i] = 1;
393  for (int j = 1; j < i; j++) {
394  C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
395  }
396  }
397 
398  ON_BezierSurface *reducedsurf = new ON_BezierSurface(3, false, dsp_ip->dsp_xcnt, dsp_ip->dsp_ycnt);
399  *reducedsurf = *bezsurf;
400  unsigned int currentdegree = dsp_ip->dsp_xcnt;
401  bool exceedtol = false;
402  ON_SimpleArray<ON_3dPointArray *> bezcurvarray(dsp_ip->dsp_ycnt);
403  for (unsigned int y = 0; y < dsp_ip->dsp_ycnt; y++) {
404  bezcurvarray[(const int)y] = new ON_3dPointArray(dsp_ip->dsp_xcnt);
405  for (unsigned int x = 0; x < dsp_ip->dsp_xcnt; x++) {
406  bezcurvarray[(const int)y]->Append(bezsurf->CV(x, y));
407  }
408  }
409  while (currentdegree && !exceedtol) {
410  for (unsigned int y = 0; y < dsp_ip->dsp_ycnt; y++) {
411  if (DegreeReduction(currentdegree - 1, *bezcurvarray[(const int)y], tol, maxerr) == -1) {
412  exceedtol = true;
413  break;
414  }
415  }
416  if (!exceedtol) {
417  currentdegree--;
418  for (unsigned int y = 0; y < dsp_ip->dsp_ycnt; y++) {
419  for (unsigned int x = 0; x <= currentdegree; x++) {
420  reducedsurf->SetCV(x, y, (*bezcurvarray[(const int)y])[(const int)x]);
421  }
422  }
423  }
424  }
425  reducedsurf->m_order[0] = currentdegree;
426 
427  exceedtol = false;
428  tol = max_delta * 5.0 * currentdegree;
429  maxerr = 0.0;
430  currentdegree = dsp_ip->dsp_ycnt;
431  for (int i = 0; i < bezcurvarray.Count(); i++) {
432  delete bezcurvarray[i];
433  }
434  bezcurvarray.Empty();
435  bezcurvarray.SetCount(reducedsurf->m_order[0]);
436  for (int x = 0; x < reducedsurf->m_order[0]; x++) {
437  bezcurvarray[x] = new ON_3dPointArray(dsp_ip->dsp_ycnt);
438  for (unsigned int y = 0; y < dsp_ip->dsp_ycnt; y++) {
439  bezcurvarray[x]->Append(reducedsurf->CV(x, y));
440  }
441  }
442  while (currentdegree && !exceedtol) {
443  for (int x = 0; x < reducedsurf->m_order[0]; x++) {
444  if (DegreeReduction(currentdegree - 1, *bezcurvarray[x], tol, maxerr) == -1) {
445  exceedtol = true;
446  break;
447  }
448  }
449  if (!exceedtol) {
450  currentdegree--;
451  for (int x = 0; x < reducedsurf->m_order[0]; x++) {
452  for (unsigned int y = 0; y <= currentdegree; y++) {
453  reducedsurf->SetCV(x, y, (*bezcurvarray[(const int)x])[(const int)y]);
454  }
455  }
456  }
457  }
458  reducedsurf->m_order[1] = currentdegree;
459  for (int i = 0; i < bezcurvarray.Count(); i++) {
460  delete bezcurvarray[i];
461  }
462 
463  ON_NurbsSurface *tnurbssurf = ON_NurbsSurface::New();
464  reducedsurf->GetNurbForm(*tnurbssurf);
465  (*b)->NewFace(*tnurbssurf);
466 
467  delete bezsurf;
468  delete reducedsurf;
469 }
470 
471 
472 // Local Variables:
473 // tab-width: 8
474 // mode: C++
475 // c-basic-offset: 4
476 // indent-tabs-mode: t
477 // c-file-style: "stroustrup"
478 // End:
479 // ex: shiftwidth=4 tabstop=8
void bu_log(const char *,...) _BU_ATTR_PRINTF12
Definition: log.c:176
fastf_t C[2 *MAX_CNT+1][2 *MAX_CNT+1]
Definition: dsp_brep.cpp:38
#define VSET(a, b, c, d)
Definition: color.c:53
#define VSETALL(a, s)
Definition: color.c:54
Header file for the BRL-CAD common definitions.
void rt_dsp_brep(ON_Brep **b, const struct rt_db_internal *ip, const struct bn_tol *)
Definition: dsp_brep.cpp:104
COMPLEX data[64]
Definition: fftest.c:34
#define RT_CK_DB_INTERNAL(_p)
Definition: raytrace.h:207
#define NEAR_ZERO(val, epsilon)
Definition: color.c:55
int DegreeReduction(int n, ON_3dPointArray &bezcurv, fastf_t tol, fastf_t &maxerr)
Definition: dsp_brep.cpp:40
Support for uniform tolerances.
Definition: tol.h:71
#define DSP(_p, _x, _y)
Definition: dsp.h:29
void * idb_ptr
Definition: raytrace.h:195
HIDDEN const point_t delta
Definition: sh_prj.c:618
double fastf_t
Definition: defines.h:300
#define MOVEPT(_p)
Definition: dsp_brep.cpp:35
#define MAX_CNT
Definition: dsp_brep.cpp:36