Hello Andreas, your CatmullRomSpline is really impressive, but it draws not a real ellipse. If it would, this code should produce a circle, right? var points:Array = new Array( {x: 0, y: 0}, {x: 0, y: 50}, {x:50, y: 50}, {x:50, y: 0}, {x: 0, y: 0}); var spline:CatmullRomSpline = new CatmullRomSpline(points); var approxLineLength:Number = 3; spline.plotAll(mc, approxLineLength);
How is the bend of the curve defined? Matthias 2006/10/5, Andreas Weber <[EMAIL PROTECTED]>:
Instead of re-inventing the wheel (which can be a lot of fun!) you might find it easier to use an already existing Spline class, e.g. my CatmullRom Spline: http://www.motiondraw.com/md/as_samples/t/CatmullRomSpline/closedShape.html The advantage is that you can just pass in the corner points of the textfield (or, if you want some 'padding', it's easy to calculate the corners of the outer rectangle) - the spline will automatically curve through these points. If you are interested in the Math of Splines, don't miss the in-depth tutorials by Jim Armstrong: http://www.2112fx.com/ hth -------------- Andreas Weber -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Matthias Dittgen Sent: Donnerstag, 5. Oktober 2006 09:41 To: Flashcoders mailing list Subject: [Flashcoders] geometry // oval around text Hello, I need a tipp for drawing an oval around a dynamic textfield with variable line numbers and variable width? Perhaps, someone can point me to a good tutorial dealing with such geometry questions. The drawOval methods I am using have width and height as parameters, but of course I can't use width and height of the textfield without a padding. How can I calculate an i appropriate padding? The drawOval methods: public function drawOval_Old(x:Number, y:Number, width:Number, height:Number):Void { movieClip.lineStyle(lw, lc, la); movieClip.moveTo(x,y+height/2); movieClip.curveTo(x,y,x+width/2, y); movieClip.curveTo(x+width,y,x+width, y+height/2); movieClip.curveTo(x+width,y+height, x+width/2, y+height); movieClip.curveTo(x,y+height, x, y+height/2); } public function drawOval(x:Number, y:Number, width:Number, height:Number):Void { x+=width/2; y+=height/2; width/=2; height/=2; var j:Number = width * 0.70711; var n:Number = height * 0.70711; var i:Number = j - (height - n) * width/height; var m:Number = n - (width - j) * height/width; movieClip.lineStyle(lw, lc, la); movieClip.moveTo(x+width, y); movieClip.curveTo(x+width, y-m, x+j, y-n); movieClip.curveTo(x+i, y-height, x, y-height); movieClip.curveTo(x-i, y-height, x-j, y-n); movieClip.curveTo(x-width, y-m, x-width, y); movieClip.curveTo(x-width, y+m, x-j, y+n); movieClip.curveTo(x-i, y+height, x, y+height); movieClip.curveTo(x+i, y+height, x+j, y+n); movieClip.curveTo(x+width, y+m, x+width, y); } Thanks, Matthias _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
_______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com