Re: [Newbies] Drawing an Arc.

2006-07-09 Thread Hilaire Fernandes
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.

2006-07-09 Thread Claudio Acciaresi
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