composed-curve strange behavior when used on small curves
Created by: reiniervandijk
Try:
(define-object composed-curve-error (base-object)
:objects
((curve-1 :type 'linear-curve :start (the center) :end (translate (the center) :right 0.1))
(curve-2 :type 'linear-curve :start (the center) :end (translate (the center) :rear 0.001))
(composed :type 'composed-curve :curves (list (the curve-1) (the curve-2)))
(composed-2 :type 'composed-curve :curves (list (the curve-1) (the curve-2)) :coincident-point-tolerance 0.0001)
(composed-3 :type 'composed-curve :curves (list (the curve-1) (the curve-2))
:coincident-point-tolerance 0.00001
:distance-to-create-line 0.00001)
))
first composition leads to 1 curve that completely ignores curve-2. This is probably due to the coincident-point tolerance that is rather large by default (0.01). Setting it to a lower value (composed-2), leads to an error "two curves result". What!? Playing around with the distance-to-create-line value even leads to more intuitive errors:
!! This section threw error: Attempt to take the car of -106824 which is not listp. !!
I personally believe that the composed-curve should detect cases where curves are completely ignored in the end-result or at least be able to predict this will happen and then inform the user. I had several cases with students who couldn't explain their end results because of such things.
Imported comments:
By genworks on 2013-08-08 17:06:37 UTC
Although this should not be the case, you will get better results from composed-curve if the input curves are already ordered and chained end-to-end. The version below passes the input data with the curves already chained, and gives expected results for composed and composed-2. The distance-to-create-line does not behave well.
There is an unsupported, undocumented function surf::chain-nurbs-curves which can help with chaining the curves end-to-end. This function should probably be documented and supported, and perhaps used by default on the inputs to composed-curve.
(define-object composed-curve-error (base-object)
:objects
((curve-2 :type 'linear-curve
:start (the center)
:end (translate (the center) :right 0.1))
(curve-1 :type 'linear-curve
:end (the center)
:start (translate (the center) :rear 0.001))
(composed :type 'composed-curve
:curves (list (the curve-1) (the curve-2)))
(composed-2 :type 'composed-curve
:curves (list (the curve-1) (the curve-2))
:coincident-point-tolerance 0.0001)
(composed-3 :type 'composed-curve
:curves (list (the curve-1) (the curve-2))
:coincident-point-tolerance 0.00001
;;:distance-to-create-line 0.00001
)))