[LDPartEditor] 0.8.18 Beta Released


CSG Help (Off-Topic)
#14
(2016-07-19, 9:32)Willy Tschager Wrote: I'm fixing:

30082.dat

I tried to use CSG to rebuild to cut sphere. Here is what I came up with, based on your tutorial on the wiki:


Code:
0 BFC CERTIFY CCW

0 // Set the quality and epsilon value (optional)
0 // SYNTAX 0 !LPE CSG_QUALITY [3 to 48]
0 !LPE CSG_QUALITY 16
0 // SYNTAX 0 !LPE CSG_EPSILON [>=.0001]
0 !LPE CSG_EPSILON .0001

0 // Define the shapes
0 // SYNTAX 0 !LPE [CSG SHAPE] [ID (can be any string without spaces)] [COLOUR] [MATRIX]
0 !LPE CSG_ELLIPSOID a 1  0 0 10 7 0 0 0 0 7 0 -7 0
0 !LPE CSG_CUBOID    b 4  0 0 0 10 0 0 0 10 0 0 0 10

0 !LPE CSG_CYLINDER z 14 0 -7 13.5 2.5 0 0 0 14 0 0 0 2.5
0 !LPE CSG_CUBOID y 4  0 -4.5 16.5 2.5 0 0 0 2.5 0 0 0 3
0 !LPE CSG_CUBOID x 4  0 4.5 16.5 2.5 0 0 0 2.5 0 0 0 3

0 // Modify the shapes
0 // SYNTAX 0 !LPE [CSG FUNCTION] [origin ID] [origin ID2] [target ID3]
0 !LPE CSG_DIFFERENCE a b f
0 !LPE CSG_UNION x y w
0 !LPE CSG_UNION w z v
0 !LPE CSG_DIFFERENCE f v u

0 // Compile the output
0 // SYNTAX 0 !LPE CSG_COMPILE [ID]
0 // The COMPILE command displays the CSG volume on the screen
0 // Inlining the following line will generate triangles of the CSG volume
0 !LPE CSG_COMPILE u


I also inlined the compiled U but was not very happy with the output, so I guess there is room for improvement of my code. Any help and suggestion is welcomed.


Well, the CSG code is fine... To clean the output, I normally exploit part symmetries to save some work and finally use the MeshReduce tool and do some manual tweaking.
It is extremly difficult to "automagically" optimise these CSG meshes very fast (without destroying them).
I appreciate any technical advice how I can improve the output quality.
Maybe someone nows a better CSG algorithm?

Here are my authoring results (no primitive substitution):

Code:
0 BFC CERTIFY CCW

4 1 4.57297 1.89419 14.94975 5.97487 2.47487 12.67878 4.57297 4.57297 12.67878 3.5 3.5 14.94975
4 1 4.94975 0 14.94975 6.46716 0 12.67878 5.97487 2.47487 12.67878 4.57297 1.89419 14.94975
4 1 6.46716 0 12.67878 4.94975 0 14.94975 4.57297 -1.89419 14.94975 5.97487 -2.47487 12.67878
4 1 3.5 -3.5 14.94975 4.57297 -4.57297 12.67878 5.97487 -2.47487 12.67878 4.57297 -1.89419 14.94975
4 1 4.94975 4.94975 10 4.57297 4.57297 12.67878 5.97487 2.47487 12.67878 6.46716 2.67878 10
4 1 6.46716 0 12.67878 7 0 10 6.46716 2.67878 10 5.97487 2.47487 12.67878
4 1 7 0 10 6.46716 0 12.67878 5.97487 -2.47487 12.67878 6.46716 -2.67878 10
4 1 4.57297 -4.57297 12.67878 4.94975 -4.94975 10 6.46716 -2.67878 10 5.97487 -2.47487 12.67878
4 4 4.94975 -4.94975 10 2.67878 -6.46716 10 0 -7 10 6.46716 -2.67878 10
4 4 0 -7 10 0 7 10 2.67878 6.46716 10 6.46716 -2.67878 10
3 4 6.46716 -2.67878 10 6.46716 2.67878 10 7 0 10
4 4 6.46716 2.67878 10 6.46716 -2.67878 10 2.67878 6.46716 10 4.94975 4.94975 10
4 1 2.67878 0 16.46716 4.94975 0 14.94975 4.57297 1.89419 14.94975 2.5 1.03553 16.44898
3 1 2.5 1.03553 16.44898 0 0 17 2.67878 0 16.46716
4 1 2.5 1.03553 16.44898 4.57297 1.89419 14.94975 3.5 3.5 14.94975 2.5 2 16.08394
4 1 2.5 2 16.08394 2 2 16.36717 1.89419 1.89419 16.46716 2.5 1.03553 16.44898
3 1 2.5 1.03553 16.44898 1.89419 1.89419 16.46716 0 0 17
4 1 2.47487 5.97487 12.67878 2.39713 5.78718 12.98283 2.5 5.31083 13.5 4.57297 4.57297 12.67878
4 1 3.5 3.5 14.94975 4.57297 4.57297 12.67878 2.5 5.31083 13.5 2.5 4.16818 14.94975
3 1 1.89419 1.89419 16.46716 2 2 16.36717 1.73583 2 16.46716
3 1 2.5 2 16.08394 3.5 3.5 14.94975 2.5 4.16818 14.94975
3 1 1.89419 1.89419 16.46716 1.73583 2 16.46716 0 0 17
3 1 2.39713 5.78718 12.98283 2.47487 5.97487 12.67878 2.33665 6.00237 12.67878
3 1 1.73583 2 16.46716 0 2 16.60218 0 0 17
3 1 2.33665 -6.00237 12.67878 2.47487 -5.97487 12.67878 2.39713 -5.78718 12.98283
3 1 2.39713 -5.78718 12.98283 2.47487 -5.97487 12.67878 4.57297 -4.57297 12.67878
3 1 0 -2 16.60218 1.73583 -2 16.46716 0 0 17
4 1 2.5 -4.16818 14.94975 2.39713 -5.78718 12.98283 4.57297 -4.57297 12.67878 3.5 -3.5 14.94975
3 1 2.5 -4.16818 14.94975 3.5 -3.5 14.94975 2.5 -2 16.08394
3 1 1.73583 -2 16.46716 2 -2 16.36717 1.89419 -1.89419 16.46716
3 1 1.73583 -2 16.46716 1.89419 -1.89419 16.46716 0 0 17
4 1 3.5 -3.5 14.94975 4.57297 -1.89419 14.94975 2.47487 -1.02513 16.46716 2.5 -2 16.08394
3 1 1.89419 -1.89419 16.46716 2.47487 -1.02513 16.46716 0 0 17
4 1 2.5 -2 16.08394 2.47487 -1.02513 16.46716 1.89419 -1.89419 16.46716 2 -2 16.36717
4 1 2.47487 -1.02513 16.46716 4.57297 -1.89419 14.94975 4.94975 0 14.94975 2.67878 0 16.46716
3 1 2.47487 -1.02513 16.46716 2.67878 0 16.46716 0 0 17
4 1 4.57297 4.57297 12.67878 4.94975 4.94975 10 2.67878 6.46716 10 2.47487 5.97487 12.67878
4 1 2.33665 6.00237 12.67878 2.47487 5.97487 12.67878 2.67878 6.46716 10 1.76777 6.30381 11.73223
4 1 1.76777 6.30381 11.73223 2.67878 6.46716 10 0 7 10 .95671 6.57293 11.1903
3 1 .95671 6.57293 11.1903 0 7 10 0 6.80109 11
3 1 1.76777 -6.30381 11.73223 .95671 -6.57293 11.1903 2.67878 -6.46716 10
4 1 0 -7 10 2.67878 -6.46716 10 .95671 -6.57293 11.1903 0 -6.80109 11
4 1 2.47487 -5.97487 12.67878 2.33665 -6.00237 12.67878 1.76777 -6.30381 11.73223 2.67878 -6.46716 10
4 1 4.94975 -4.94975 10 4.57297 -4.57297 12.67878 2.47487 -5.97487 12.67878 2.67878 -6.46716 10
4 4 2.5 4.16818 14.94975 2.5 5.31083 13.5 2.5 2 13.5 2.5 2 16.08394
3 4 2.5 -4.16818 14.94975 2.5 -2 16.08394 2.5 -2 13.5
3 4 2.5 -4.16818 14.94975 2.5 -2 13.5 2.39713 -5.78718 12.98283
4 4 0 2 16.60218 1.73583 2 16.46716 2 2 16.36717 0 2 16
4 4 2 2 16.36717 2.5 2 16.08394 2.5 2 13.5 2.3097 2 14.45671
3 4 .95671 2 15.8097 2 2 16.36717 1.76777 2 15.26777
3 4 .95671 2 15.8097 0 2 16 2 2 16.36717
4 14 0 -6.80109 11 .95671 -6.57293 11.1903 .95671 6.57293 11.1903 0 6.80109 11
4 14 2.33665 6.00237 12.67878 1.76777 6.30381 11.73223 1.76777 -6.30381 11.73223 2.33665 -6.00237 12.67878
4 14 .95671 -6.57293 11.1903 1.76777 -6.30381 11.73223 1.76777 6.30381 11.73223 .95671 6.57293 11.1903
3 14 2.5 2 13.5 2.33665 6.00237 12.67878 2.33665 -6.00237 12.67878
4 14 2.5 5.31083 13.5 2.39713 5.78718 12.98283 2.33665 6.00237 12.67878 2.5 2 13.5
4 4 1.73583 -2 16.46716 0 -2 16.60218 0 -2 16 .95671 -2 15.8097
4 4 2 -2 16.36717 2.3097 -2 14.45671 2.5 -2 13.5 2.5 -2 16.08394
4 4 1.76777 -2 15.26777 2.3097 -2 14.45671 2 -2 16.36717 1.73583 -2 16.46716
3 4 .95671 -2 15.8097 1.76777 -2 15.26777 1.73583 -2 16.46716
4 14 2.39713 -5.78718 12.98283 2.5 -2 13.5 2.5 2 13.5 2.33665 -6.00237 12.67878
4 14 2.3097 -2 14.45671 1.76777 -2 15.26777 1.76777 2 15.26777 2.3097 2 14.45671
4 14 2.5 -2 13.5 2.3097 -2 14.45671 2.3097 2 14.45671 2.5 2 13.5
4 14 .95671 -2 15.8097 0 -2 16 0 2 16 .95671 2 15.8097
4 14 .95671 2 15.8097 1.76777 2 15.26777 1.76777 -2 15.26777 .95671 -2 15.8097
3 4 2.3097 2 14.45671 1.76777 2 15.26777 2 2 16.36717
Reply
« Next Oldest | Next Newest »



Messages In This Thread
Updater works now. - by Nils Schmidt - 2016-07-13, 18:20
Tab feature is complete... - by Nils Schmidt - 2016-07-20, 22:02
CSG Help (Off-Topic) - by Nils Schmidt - 2016-07-21, 9:09
Wrapper window - by Nils Schmidt - 2016-07-20, 21:55

Forum Jump:


Users browsing this thread: 2 Guest(s)