EllipticalArc.st
author claus
Tue, 06 Jun 1995 06:02:23 +0200
changeset 78 1be30ee4b5cc
child 84 d401ce0001dc
permissions -rw-r--r--
.

"
 COPYRIGHT (c) 1995 by Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"

Geometric subclass: #EllipticalArc 
	instanceVariableNames: 'boundingBox  startAngle sweepAngle'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Graphics-Geometry'
!

!EllipticalArc class methodsFor: 'documentation'!

copyright
"
 COPYRIGHT (c) 1995 by Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
!

version
"
$Header: /cvs/stx/stx/libbasic2/EllipticalArc.st,v 1.1 1995-06-06 04:01:53 claus Exp $
"
!

documentation
"
     This class implements an ellipse which is aligned to x and y axes
     given a boundingBox, a startAngle and a sweepAngle.
     Positive angles are taken clockwise, negative angles are counterclockwise.
"
! !

!EllipticalArc class methodsFor:'instance creation'!

boundingBox:aRectangle
    "Return a new EllipticalArc."

    ^ self new boundingBox:aRectangle
!

boundingBox:aRectangle startAngle:startAngle sweepAngle:sweepAngle
    "Return a new EllipticalArc."

    ^ self new boundingBox:aRectangle startAngle:startAngle sweepAngle:sweepAngle
!

center:centerPoint radius:radius
    "Return a new Circle."

    ^ self new center:centerPoint radius:radius
! !

!EllipticalArc methodsFor:'converting'!

asEllipticalArc
    ^ self 
! !

!EllipticalArc methodsFor:'queries'!

canBeFilled
    ^ true
! !

!EllipticalArc methodsFor:'displaying'!

displayStrokedOn:aGC
    aGC displayArcX:boundingBox left
		  y:boundingBox top
	      width:boundingBox width
	     height:boundingBox height
	       from:startAngle
		 to:(startAngle+sweepAngle)
!

displayFilledOn:aGC
    aGC fillArcX:boundingBox left
	       y:boundingBox top
	   width:boundingBox width
	  height:boundingBox height
	    from:startAngle
	      to:(startAngle+sweepAngle)
! !

!EllipticalArc methodsFor:'accessing'!

boundingBox:aRectangle startAngle:start sweepAngle:sweep
    "set the center and radius"

    boundingBox := aRectangle.
    startAngle := start.
    sweepAngle := sweep
!

boundingBox:aRectangle
    "set the center and radius"

    boundingBox := aRectangle.
    startAngle := 0.
    sweepAngle := 360
!

center:centerPoint radius:radiusNumber
    "set the center and radius"

    ^ self boundingBox:((center-r) asPoint corner:(center+r) asPoint).
!

startAngle
    "return the startAngle."

    ^ startAngle
! 

sweepAngle
    "return the sweepAngle."

    ^ sweepAngle
!

center
    ^ boundingBox center
! !