From 3f2404a62861fd2e3e5529130f66e490c11fb095 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Sun, 22 Jan 2017 14:47:50 -0800 Subject: [PATCH] nurbs: cleanup. --- extra/nurbs/nurbs.factor | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/extra/nurbs/nurbs.factor b/extra/nurbs/nurbs.factor index 858e1f7401..1b5a636914 100644 --- a/extra/nurbs/nurbs.factor +++ b/extra/nurbs/nurbs.factor @@ -1,9 +1,9 @@ -! (c)2009 Joe Groff bsd license -USING: accessors alien.c-types arrays grouping kernel locals -math math.order math.ranges math.vectors -math.vectors.homogeneous sequences specialized-arrays ; -FROM: alien.c-types => float ; -SPECIALIZED-ARRAY: float +! Copyright (C) 2009 Joe Groff +! See http://factorcode.org/license.txt for BSD license +USING: accessors alien.c-types grouping kernel locals math +math.order math.ranges math.vectors math.vectors.homogeneous +sequences specialized-arrays ; +SPECIALIZED-ARRAY: alien.c-types:float IN: nurbs TUPLE: nurbs-curve @@ -55,10 +55,10 @@ TUPLE: nurbs-curve knot-constants second t * knot-constants fourth + bases second * + ; -: (eval-curve) ( base-values control-points -- value ) +: eval-curve ( base-values control-points -- value ) [ n*v ] 2map { 0.0 0.0 0.0 } [ v+ ] binary-reduce h>v ; -:: (eval-bases) ( curve t interval values order -- values' ) +:: eval-bases ( curve t interval values order -- values' ) order 2 - curve (knot-constants)>> nth :> all-knot-constants interval order interval + all-knot-constants clip-range :> ( from to ) from to all-knot-constants subseq :> knot-constants @@ -66,8 +66,8 @@ TUPLE: nurbs-curve knot-constants bases [ t eval-base ] 2map :> values' order curve order>> = - [ values' from to curve control-points>> subseq (eval-curve) ] - [ curve t interval 1 - values' order 1 + (eval-bases) ] if ; + [ values' from to curve control-points>> subseq eval-curve ] + [ curve t interval 1 - values' order 1 + eval-bases ] if ; : eval-nurbs ( nurbs-curve t -- value ) - 2dup knot-interval 1 - { 1.0 } 2 (eval-bases) ; + 2dup knot-interval 1 - { 1.0 } 2 eval-bases ;