sketchucation logo sketchucation
    • Login
    1. Home
    2. steven-arts
    3. Posts
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    S
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 0
    • Posts 1
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: [Plugin] SketchyFFD (Classic)

      Hi Chriss,

      it really makes fun to work with FFD! I looked at your code and found the factorial function where you mentioned to encrease performance by adding a table for factorials. I made it dynamic and it boosts your code! Just replace the section with:

      
      #used by calcBernstein. could be replaced by a table since in 
      #this application n is never more than 3 (number of control points).
      $fTable = []
      def factorial(n)
          sum = $fTable.rassoc(n)
          if sum
          	return sum[0]
          else
      	sum = 1
      	sum.upto(n) { |i| sum *= i }
      	$fTable << [sum, n]
      	return sum
          end
      end
      

      Ciao, Stefan

      posted in Plugins
      S
      steven-arts
    • 1 / 1