Re: Design problem



Robert C. Martin wrote:
> On 6 Jan 2006 13:38:11 -0800, roberts.noah@xxxxxxxxx wrote:
>
> >I'm having trouble with what seems like it should be a relatively
> >simple problem and am wondering what ideas people here might have.
> >
> >I have a shape class and inside this shape are "elements" (vector drawn
> >based system).  Certain things can be done to shapes, namely you can
> >rotate, skew, flip, zoom..ummm...that's about it but you never know
> >what could be added.  Elements at this point can comprise of one of the
> >following three constructs: A line; a polygon/polyline; or a circle.
> >Lines are two point elements that contain a line from one to the other.
> > Polygons are point coordinate arrays with a start and an end; empty
> >polygons are actually lines from point to point otherwise it is a
> >filled element.  A circle is a center and a radius.
> >
> >Now the problem.  Sometimes these operations are done one after the
> >other and I can increase speed (and yes we want it to be fast) if I can
> >do them all at once.  I want a raw "perform" function on either the
> >element or the operation so that I can pass in individual operations or
> >constructs of operations.  The easy way to do this is to build matrices
> >and pass them in, but how to apply these to a circle??  I can of course
> >have enums representing types of operations and have some ifs in the
> >circle construct but this fails the LSP (and I happen to agree with
> >that principle).  I do have a couple of ideas but there are failings in
> >all of them (including rethinking how a circle is represented).
> >
> >What ideas do you guys have?
>
> Think of a circle as being defined by the radius line.  It's not a
> point and a length, it's two points.
>

Thats fine and dandy, but the space of circles is not closed under the
operations described...

i.e. compressing the Y axis makes a circle into a ellipse, not a little
circle.

.



Relevant Pages

  • [SUMMARY] The Smallest Circle (#157)
    ... about the smallest enclosing circle problem... ... def initialize(*coords) ... y_big is the minimum radius of a circle ... always been the square of the radius, we finally take its square root ...
    (comp.lang.ruby)
  • Re: need help with homework
    ... So if you solve for circumference you get pi x diameter, ... Now if you know relation between diameter and radius, ... Center of circle splits diameter into two radii. ... circular disk, i.e. a disk whose perimiter is a circle. ...
    (sci.math)
  • Re: Somebody splain to me about neck radius and...
    ... my regular standard style guitar. ... well over 1/4" off the fretboard, plus I use the bottom 6 strings from ... A fretboard radius is simply that. ... radius of the circle where that arc comes from. ...
    (alt.guitar)
  • Re: Somebody splain to me about neck radius and...
    ... my regular standard style guitar. ... well over 1/4" off the fretboard, plus I use the bottom 6 strings from ... A fretboard radius is simply that. ... radius of the circle where that arc comes from. ...
    (alt.guitar)
  • Re: Help with extend
    ... I have a superclass GeometricObject which compiles. ... Then I have a subclass Circle which extends the superclass, but the compiler doesn't like it and i get the following error (cannot find symbol ... public void setFilled{ ... public Circle(double radius) { ...
    (comp.lang.java.help)