Hi, again, I don't believe I can solve this alone, and the task is complicated and also challenging, so I am posting my code for this... As I wrote it, now it checks for face-face crossings or touchings, but every method I can think isn't good enough... Simple question would be : how to make ACAD distinguish between inner and outer 3dfaces that should wrap RND point cloud... The best would be if possible to generate only outer faces in start, but as this seems to undefined I decided to make all 3dfaces, and then to remove inner ones... Still I don't know how to achieve this even if I cycle through each face to face check, for it seems that they all touches themselves with each other... I just simply can't find appropriate method to try to apply to 3dface cloud...
I don't expect this is easy task, and I work and use only ALISP, so maybe if someone can think what should I look for, please help...
(defun touch23df
-p
( f1p1 f1p2 f1p3 f1p4 f2p1 f2p2 f2p3 f2p4
/ a1 a2 ap0 ap1 ap2 b1 b2 bp0 bp1 bp2 c1 c2 cp0 cp1 cp2 d dp0 dp1 dp2 dx dy dz p1 p1x p1y p1z p2 p2x p2y p2z pp1 pp2 pp3 pp4 pp5 pp6 ptp1 ptp2 ptp3 ptp4 ptp5 ptp6 vlx vly vlz
)
(if (equal f1p1 f1p2 1e
-8
) (setq ptp1 f1p1 ptp2 f1p3 ptp3 f1p4
)) (if (equal f1p1 f1p3 1e
-8
) (setq ptp1 f1p1 ptp2 f1p2 ptp3 f1p4
)) (if (equal f1p1 f1p4 1e
-8
) (setq ptp1 f1p1 ptp2 f1p2 ptp3 f1p3
)) (if (equal f1p2 f1p3 1e
-8
) (setq ptp1 f1p1 ptp2 f1p2 ptp3 f1p4
)) (if (equal f1p2 f1p4 1e
-8
) (setq ptp1 f1p1 ptp2 f1p2 ptp3 f1p3
)) (if (equal f1p3 f1p4 1e
-8
) (setq ptp1 f1p1 ptp2 f1p2 ptp3 f1p3
))
(if (equal f2p1 f2p2 1e
-8
) (setq ptp4 f2p1 ptp5 f2p3 ptp6 f2p4
)) (if (equal f2p1 f2p3 1e
-8
) (setq ptp4 f2p1 ptp5 f2p2 ptp6 f2p4
)) (if (equal f2p1 f2p4 1e
-8
) (setq ptp4 f2p1 ptp5 f2p2 ptp6 f2p3
)) (if (equal f2p2 f2p3 1e
-8
) (setq ptp4 f2p1 ptp5 f2p2 ptp6 f2p4
)) (if (equal f2p2 f2p4 1e
-8
) (setq ptp4 f2p1 ptp5 f2p2 ptp6 f2p3
)) (if (equal f2p3 f2p4 1e
-8
) (setq ptp4 f2p1 ptp5 f2p2 ptp6 f2p3
))
(setq vlx
(- (* bp1 cp2
) (* bp2 cp1
))) (setq vly
(- (* ap2 cp1
) (* ap1 cp2
))) (setq vlz
(- (* ap1 bp2
) (* ap2 bp1
)))
(setq D
(+ (* ap1 bp2 cp0
) (* bp1 cp2 ap0
) (* cp1 ap2 bp0
) (* -1 ap0 bp2 cp1
) (* -1 bp0 cp2 ap1
) (* -1 cp0 ap2 bp1
) ))
(setq vlx
(- (* bp1 cp2
) (* bp2 cp1
))) (setq vly
(- (* ap2 cp1
) (* ap1 cp2
))) (setq vlz
(- (* ap1 bp2
) (* ap2 bp1
)))
(setq D
(+ (* ap1 bp2 cp0
) (* bp1 cp2 ap0
) (* cp1 ap2 bp0
) (* -1 ap0 bp2 cp1
) (* -1 bp0 cp2 ap1
) (* -1 cp0 ap2 bp1
) )) ))
(setq vlx
(- (* bp1 cp2
) (* bp2 cp1
))) (setq vly
(- (* ap2 cp1
) (* ap1 cp2
))) (setq vlz
(- (* ap1 bp2
) (* ap2 bp1
)))
(setq D
(+ (* ap1 bp2 cp0
) (* bp1 cp2 ap0
) (* cp1 ap2 bp0
) (* -1 ap0 bp2 cp1
) (* -1 bp0 cp2 ap1
) (* -1 cp0 ap2 bp1
) )) ))
(setq Dx
(+ (* dp1 bp2 cp0
) (* bp1 cp2 dp0
) (* cp1 dp2 bp0
) (* -1 dp0 bp2 cp1
) (* -1 bp0 cp2 dp1
) (* -1 cp0 dp2 bp1
) )) (setq Dy
(+ (* ap1 dp2 cp0
) (* dp1 cp2 ap0
) (* cp1 ap2 dp0
) (* -1 ap0 dp2 cp1
) (* -1 dp0 cp2 ap1
) (* -1 cp0 ap2 dp1
) )) (setq Dz
(+ (* ap1 bp2 dp0
) (* bp1 dp2 ap0
) (* dp1 ap2 bp0
) (* -1 ap0 bp2 dp1
) (* -1 bp0 dp2 ap1
) (* -1 dp0 ap2 bp1
) ))
)
)
(if (and pp1 pp2 pp3 pp4 pp5 pp6
) nil
T
)
)
(defun c:ptscloud
-3dfaces
( / ss n pt 3df ss3df sss m 3df1 3df1dxf 3df1p1 3df1p2 3df1p3 3df1p4 k 3df2 3df2dxf 3df2p1 3df2p2 3df2p3 3df2p4 ptlst
) )
)
)
)
(if (touch23df
-p 3df1p1 3df1p2 3df1p3 3df1p4 3df2p1 3df2p2 3df2p3 3df2p4
) (ssadd 3df1 sss
)) )
)
)
)
)
(defun c:pts
-3df
nil (c:ptscloud
-3dfaces
))
(prompt "\nShortcut for c:ptscloud-3dfaces is c:pts-3df \n[Start with : Command: pts-3df]")
P.S. I'll attach 10 rnd point cloud, so you can do tests on it as with each point added time for processing is longer and therefore not practical...
If you solve this, I suggest that you try this with more points - download it from this link :
http://www.theswamp.org/index.php?topic=44160.msg494171#msg494171Sincerely, M.R.