quantum instance?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

quantum instance?

Arthur-27
Trying to handle the sudden change of state of an instance of an object
- a "quantum instance"

c starts as a Circle instance.

Say, in the course of the manipulation of c its radius approaches
towards infinity, and upon the radius becoming > than some Max, I want c
to suddenly think of itself as a Line instance rather than as a Circle
instance.

doable?

hints?

Art

 
_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: quantum instance?

Scott David Daniels
Arthur wrote:

> Trying to handle the sudden change of state of an instance of an object
> - a "quantum instance"
>
> c starts as a Circle instance.
>
> Say, in the course of the manipulation of c its radius approaches
> towards infinity, and upon the radius becoming > than some Max, I want c
> to suddenly think of itself as a Line instance rather than as a Circle
> instance.
>
> doable?
>
> hints?
>
> Art

As a sketch:

class Blended(object):
     MaxRadius = 123456

     def __init__(self, radius):
         self._active = Circle(radius=radius)
         self._other = Line()
         self.radius = radius  # Switch to Line if necessary

     def __getattr__(self, name):
         return getattr(self._active, name)

     def __setattr__(self, name, value):
        if name[0] == '_':
            object.__setattr__(self, name, value)
        elif name[0] != 'radius':
            return setattr(self, value)
         if value < self.MaxRadius:
             if isinstance(self._active, Line):
                 self._active, self._other = self._other, self._active
         else:
             if isinstance(self._active, Circle):
                 self._active, self._other = self._other, self._active
         self._active.radius = value


You could read up on __getattr__, __getattribute__, and friends in
the Language References section 3.3.2:
     Customizing attribute access

--Scott David Daniels
[hidden email]

_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: quantum instance?

Kirby Urner
In reply to this post by Arthur-27
> Say, in the course of the manipulation of c its radius approaches
> towards infinity, and upon the radius becoming > than some Max, I want c
> to suddenly think of itself as a Line instance rather than as a Circle
> instance.
>

Footnote:

In Fuller's synergetic geometry, circles don't become infinite lines, but
just bigger and bigger circles.  Lines that appear locally straight are just
that:  local.  Clearly we're starting with different assumptions than those
of Euclidean greek metaphysics.  More from Democritus.  Lines aren't
perfectly straight either -- zoom in and they become zig-zaggy/wavilinear.
Zoom out, and all you get are curves and great circles.

Kirby


_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: quantum instance?

Arthur-27
In reply to this post by Arthur-27
Kirby Urner wrote:

>In Fuller's synergetic geometry, circles don't become infinite lines, but
>just bigger and bigger circles.  Lines that appear locally straight are just
>that:  local.  Clearly we're starting with different assumptions than those
>of Euclidean greek metaphysics.  More from Democritus.  Lines aren't
>perfectly straight either -- zoom in and they become zig-zaggy/wavilinear.
>Zoom out, and all you get are curves and great circles.
>
FWIW,  I am working with (as in studying and implementing some tools in
PyGeo to enliven that study of) the geometry of complex numbers.  And
doing so in such a way that all fundamental elements are defined by its
2X2 hermitian matrix. So I am getting fairly abstract - a "line"  has  
hermitian[0][0] == 0, else I am looking at a "point" or a "circle".  
Drawing the damn things is a lot less abstract - and as hermitian[0][0]
approaches 0, a line makes a better represetantion - is all. And since
things are dynamic, I need my iinstances to think on their feet as to
what makes a better representation.  If/else is really all I need - but
I was playing in my head with trying something more "dramatic".

Fredrk Lundh  - the fbot  and author of PIL - posted a blog entry a few
months ago about working with complex numbers to do basic image
manipulation.  With Numeric in  play, I can imagine a lot of efficiency
gains by working with it  and the Python built_in complex numbers- via
Hermitian matrixes and 2X2 mobius transformation matrixes - to
accomplish a lot of the kind of image transformation effects that I
imagine are normally done otherwise.  I expect that experimentation
along these lines is going to eventually get me more into playing with
bitmap graphics, whereas until now I have been a vector graphics kind of
guy.

Art

_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: quantum instance?

Arthur-27
In reply to this post by Arthur-27
Kirby Urner wrote:

>Lines aren't
>perfectly straight either -- zoom in and they become zig-zaggy/wavilinear.
>Zoom out, and all you get are curves and great circles.
>  
>
Yes. From a bitmap perspective, anyway.

And certainly circles, even from a vector computer graphics point of
view are  actually polygons, not circles.  Which is really my problem..

And is directly related to dynamic zooming.  I am in fact attempting to
make my algorithm for converting a representation from a circle (i.e.
polygon)  to a line and back again sensitive to the  actual zoom level.

At some definition of local, the circle becomes a line.

Summer must be over .  I have time for this kind of fun again.

Art

_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig