~hilaire-fernandes/drgeo/trunk

« back to all changes in this revision

Viewing changes to src/DrGeoII-Core/Float.extension.st

  • Committer: Hilaire Fernandes
  • Date: 2017-11-15 13:17:03 UTC
  • Revision ID: hilaire.fernandes@gmail.com-20171115131703-pz09obavthi53ebt
DrGeo code under Tonel file format

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Extension { #name : #Float }
 
2
 
 
3
{ #category : #'*DrGeoII-Core-fixing' }
 
4
Float >> arcTan2: denominator [
 
5
        "Answer the angle in radians.
 
6
         Optional. See Object documentation whatIsAPrimitive."
 
7
 
 
8
        | result |
 
9
 
 
10
        (self = 0.0) 
 
11
                ifTrue: [(denominator > 0.0) 
 
12
                        ifTrue: [ result := 0 ]
 
13
                        ifFalse: [ result := Pi ]]
 
14
                ifFalse: [(denominator = 0.0)
 
15
                        ifTrue: [ (self > 0.0) 
 
16
                                ifTrue: [ result := Halfpi ]
 
17
                                ifFalse: [ result := Halfpi negated ]]
 
18
                        ifFalse: [ (denominator > 0) 
 
19
                                ifTrue: [ result := (self / denominator) arcTan ]
 
20
                                ifFalse: [ (self > 0) 
 
21
                                        ifTrue: [result := ((self / denominator) arcTan) + Pi ]
 
22
                                        ifFalse: [result := ((self / denominator) arcTan) - Pi]]
 
23
                                                        ].
 
24
                                                ].
 
25
        
 
26
        ^ result.
 
27
]