Please log in to write a message.
-
7. QED (Oct 24, 2009 23.00):
Hi Hanno,
Yes! This is the solution. Whenever the surface intersects itself the offset surface intersects with the original one. I did not run it for a 1000 tests but it does seems to be foolproof so far.
Thanks!
Regards,
Dirk
'SurfaceSelfIntersectingCheck = Sub SSinC()
'QED - 23/10/2009
'--------------------------------------------
Call SSinC()
Sub SSinC()
Dim arrSelect
Dim strSurfaceA, strSurfaceB, arrSSinC
'selects existing surface
arrSelect = Rhino.ObjectsByType(8, True)
If IsArray(arrSelect) Then
strSurfaceA = arrSelect(0)
End If
'creates offset surface at 10 units
strSurfaceB = Rhino.OffsetSurface(strSurfaceA, 10)
'checks for intersection between both surfaces
arrSSinC = Rhino.SurfaceSurfaceIntersection(strSurfaceA, strSurfaceB,, True)
'the array is empty: the surfaces do not intersect
If Not IsArray(arrSSinC) Then
Rhino.Print "Good Surface does not intersect with itself!"
Rhino.DeleteObject (strSurfaceB)
Rhino.UnselectAllObjects
Exit Sub
End If
'the array is not empty: the surfaces intersect
Rhino.Print "Bad Surface with SelfInterSecting problems!!!."
Rhino.DeleteObject (strSurfaceB)
Rhino.UnselectAllObjects
'Deletes unwanted curves which are created
Dim arrCurves
arrCurves = Rhino.ObjectsByType(4, True)
Rhino.DeleteObjects (arrCurves)
End Sub
-
6. Hanno (Oct 21, 2009 09.51):
Hi Dirk,
you are of course right. The isocurves don't self-intersect at all, there I didn't quite think it to the end :-)
What you could do is offset your surface in a rather small distance and check if the offset surface and the original one intersect. This way you automatically get a kind of safety margin that you can control by the offset distance.
But directly limiting the control point distribution at design time is still a more reasonyble approach, if you don't limit yourself too much with that.
Hanno
-
5. QED (Oct 20, 2009 17.01):
Hi Hanno,
Thanks again!
I manually played around a little bit with those IsoCurves, but they do not seem to intersect themselves, they curl in 3D space (see jpg). However, I still do have to script a test to be absolutely sure I cannot use this strategy. So, I will overwrite some of the randomly generated xyz-coordenates with fixed numbers. This way I can reasonable control the surface.
Regards,
Dirk
-
4. Hanno (Oct 19, 2009 09.40):
Hi Dirk,
another idea: maybe you could use ExtractIsoCurve to iterate through your surfaces and check these isocurves for self-intersection. Given a rather small step size between your test curves, this should be a good indicator.
Regards
Hanno
-
3. QED (Oct 19, 2009 02.23):
Hi Hanno,
Thanks for your reply.
Some command like "SurfaceIntersection" is what I need, but does not exist. I could not find anything else which would give me an indication about "intersecting", but I am not in NURBS-math.
I empirically checked on the coordinates of the control points, as you suggested. I run the script some 150 times, but I could not detect any significance in the values of the xyz-coordinates of the control points, between "bad" and "good" surfaces (or maybe I could not see/understand if something was "different").
I tried with "area" of the surface, since I noticed that most of the "bad" surfaces were smaller. But it is not fool proof. Some of the "bad" surfaces are bigger than "good" ones, although a great part of the "bad" ones can be eliminated this way.
Regards,
Dirk
-
2. Hanno (Oct 17, 2009 12.42):
Hi,
in my experience, surface analysis via script is a rather complex thing. For curves you can simply use CurveCurveIntersection to check for self-intersections, but that does not work for surfaces. There are also some validation commands like "check" in rhino, but they do not include self-intersetions.
In your case, maybe you could come up with a control point based approach, checking their positions and discarding surfaces that do not match some criteria?
If you find out something, I would be glad to hear from you!
Regards
Hanno
-
1. QED (Oct 15, 2009 16.05):
Hi All,
I am working on a script which creates new surfaces (p.e. 100 variations) by randomly changing the coordinates of the control points of a simple nurbs surface. Some of the surfaces created, however "fold" through themselves which makes them useless for further exploration. I can visually check the surfaces and manually delete them. I can also reorganize the coordinates of the control points by script, but then resulting surfaces are very similar. I do not find apparently any different value (analyse-definition-list) which I could use to classify the surfaces. Any suggestions how I can detect a "useless" self-intersecting surface?
Thanks!
Dirk