Re: [Newbies] Drawing an Arc.
Hello Claudio, You may want to give a try to my simple DrGArcMorph in the enclosed change set. To use it: a :=DrGArcMorph new a center: [EMAIL PROTECTED] radius: 100 origin: 0 length: 3.1415 a openInWorld origin and length are in radian unit Hilaire Claudio Acciaresi a écrit : Hello, I`m trying to draw an arc using Morphs, exists an easy way to do it? The acrs that i´m trying to create are like smiles of a face. I see FaceMorph, Gesture morph, but i do not want to use a PolygonMorph. Thanks a lot Claudio. 'From Squeak3.8 of ''5 May 2005'' [latest update: #6665] on 9 July 2006 at 12:23:31 pm'! DrGPolylineMorph subclass: #DrGArcMorph instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'DrGeoII-GeometryView'! !DrGArcMorph methodsFor: 'accessing' stamp: 'HilaireFernandes 1/17/2006 12:29'! center: aPoint radius: aFloat origin: anOrigin length: aLength |step costep sinstep csteX csteY mobile| step := 5 / aFloat * aLength sign. (aLength / step) abs 100 ifTrue: [step := aLength / 100]. costep := step cos. sinstep := step sin. csteX := aPoint x * (1 - costep) + (aPoint y * sinstep). csteY := aPoint y * (1 - costep) - (aPoint x * sinstep). mobile := aPoint + (aFloat * (anOrigin cos @ anOrigin sin)). vertices := OrderedCollection new add: mobile; yourself. 0 to: (aLength / step) truncated -1 do: [:i| mobile := (mobile x * costep - (mobile y * sinstep) + csteX) @(mobile x * sinstep + (mobile y * costep) + csteY). vertices add: mobile]. mobile := aPoint + (aFloat * ((anOrigin + aLength) cos @ (anOrigin + aLength) sin)). vertices add: mobile. self computeBounds! ! ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Re: [Newbies] Drawing an Arc.
Thanks a lot for your answer, I file in what you sent me, but DrGArcMorph is subclass of DrGPolylineMorph and i do not have this last class. Can i install it with SqueakMap? Claudio. - Original Message - From: Hilaire Fernandes [EMAIL PROTECTED] To: A friendly place to get answers to even the most basic questions aboutSqueak. beginners@lists.squeakfoundation.org Sent: Sunday, July 09, 2006 12:27 PM Subject: Re: [Newbies] Drawing an Arc. Hello Claudio, You may want to give a try to my simple DrGArcMorph in the enclosed change set. To use it: a :=DrGArcMorph new a center: [EMAIL PROTECTED] radius: 100 origin: 0 length: 3.1415 a openInWorld origin and length are in radian unit Hilaire Claudio Acciaresi a écrit : Hello, I`m trying to draw an arc using Morphs, exists an easy way to do it? The acrs that i´m trying to create are like smiles of a face. I see FaceMorph, Gesture morph, but i do not want to use a PolygonMorph. Thanks a lot Claudio. 'From Squeak3.8 of ''5 May 2005'' [latest update: #6665] on 9 July 2006 at 12:23:31 pm'! DrGPolylineMorph subclass: #DrGArcMorph instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'DrGeoII-GeometryView'! !DrGArcMorph methodsFor: 'accessing' stamp: 'HilaireFernandes 1/17/2006 12:29'! center: aPoint radius: aFloat origin: anOrigin length: aLength |step costep sinstep csteX csteY mobile| step := 5 / aFloat * aLength sign. (aLength / step) abs 100 ifTrue: [step := aLength / 100]. costep := step cos. sinstep := step sin. csteX := aPoint x * (1 - costep) + (aPoint y * sinstep). csteY := aPoint y * (1 - costep) - (aPoint x * sinstep). mobile := aPoint + (aFloat * (anOrigin cos @ anOrigin sin)). vertices := OrderedCollection new add: mobile; yourself. 0 to: (aLength / step) truncated -1 do: [:i| mobile := (mobile x * costep - (mobile y * sinstep) + csteX) @(mobile x * sinstep + (mobile y * costep) + csteY). vertices add: mobile]. mobile := aPoint + (aFloat * ((anOrigin + aLength) cos @ (anOrigin + aLength) sin)). vertices add: mobile. self computeBounds! ! ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners ___ 1GB gratis, Antivirus y Antispam Correo Yahoo!, el mejor correo web del mundo http://correo.yahoo.com.ar ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
[Newbies] Fun with Dates
Here's a fun little snippet of code to let you plan unusual birthday parties. Just insert a list of dates and get a list of parties, like celebrating the nd week of birth ;-) | start end parties birthday birth number party | start := (Date today subtractDays: 14) asSeconds. end := (Date today addDays: 365*5) asSeconds. parties := SortedCollection new. #('1/3/1995' '7/30/1999') do: [:each | birthday := Date fromString: each. birth := birthday asSeconds. 1 to: 9 do: [:digit | {false. true} do: [:repeatDigit | number := digit. 12 timesRepeat: [ #(1 60 3600 86400 604800) with: #('seconds' 'minutes' 'hours' 'days' 'weeks') do: [:unit :units | party := birth + (number * unit). (party between: start and: end) ifTrue: [ parties add: (Date fromSeconds: party) - (number asString, ' ', units, ' since ', birthday asString)]]. number := number * 10. repeatDigit ifTrue: [number := number + digit]. Transcript clear. parties do: [:each | Transcript show: each asString; cr]. - Bert - ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
[Newbies] implementation
Hi, I was reading code when I find several implementation of # selector. But they all have the same body. (Except for Integer). So why? Math ___ Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire. http://fr.mail.yahoo.com ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
[Newbies] Re: implementation
Hi Math, on Sun, 09 Jul 2006 23:42:28 +0200, you wrote: Hi, I was reading code when I find several implementation of # selector. You have perhaps seen that in a recent 3.9 image? But they all have the same body. (Except for Integer). You can switch on the preference to show annotation panes in browsers, then you'd see that the methods (except for CArray and Integer) are indeed the same code+version: there's only one # method propagated by the traits system. So why? Hope that helps. /Klaus Math ___ Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire. http://fr.mail.yahoo.com ___ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners