ScratchData LogoScratchData
Back to chooper-beta's profile

Bézier Curve + Memory Buffer

CHchooper-beta•Created August 2, 2015
Bézier Curve + Memory Buffer
10
6
199 views
View on Scratch

Instructions

Drag the dots around with your mouse. Click anywhere on the stage to add a new point to the bezier curve.

Description

Credit to @ScratchinJoJo for the original Bezier algorithm. This project demonstrates how to use a memory buffer to increase overall performance. IMPORTANT: This technique should only ever be used if you are in a situation where you need to constantly refresh the screen. Otherwise, I recommend broadcasting a message every time you want to refresh and attaching the render code to that. How it works: In programming, you are always trying to reduce the number of calculations to an absolute minimum. The memory buffer technique is a great way of doing this, because every time you re-calculate your values, you store them. Then, when you need to redraw the screen, you can use the pre-calculated values to render the screen without any major calculations. As a final touch, we also add a key to the top of the memory buffer which we can then use to make sure that the Bezier hasn't changed. If it has changed, we need to re-calculate all our values.

Project Details

Project ID72073418
CreatedAugust 2, 2015
Last ModifiedAugust 7, 2015
SharedAugust 2, 2015
Visibilityvisible
CommentsAllowed

Remix Information

Parent ProjectView Parent
Root ProjectView Root