Placement from center

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

Placement from center

Stuart Axon
The two transform modes we have are well and good, but it would be really useful
to have a placement mode that works like opengl, centered around the current
position.

This would mean that the following would place a large circle, with a small
circle centered on it:

    fill(0.4)
    ellipse(0, 0, 100, 100)
    fill(0, 0, 0.4)
    ellipse(0, 0, 50, 50)

I'd propose one of these to activate it:

placement(mode=CENTER)
transform(placement=CENTER)


Make sense ?
(Maybe I'm missing something here, but drawing from the center seems a bit
tricky right now)

Maybe I should make a new shoebot grammar to add the placement command though as
it's not strictly nodebox any more.

 S++



     
_______________________________________________
Shoebot-devel mailing list
[hidden email]
http://lists.tinkerhouse.net/listinfo.cgi/shoebot-devel-tinkerhouse.net
Reply | Threaded
Open this post in threaded view
|

Re: Placement from center

Sebastian Oliva
On Fri, Oct 15, 2010 at 5:45 PM, Stuart Axon <[hidden email]> wrote:

> The two transform modes we have are well and good, but it would be really useful
> to have a placement mode that works like opengl, centered around the current
> position.
>
> This would mean that the following would place a large circle, with a small
> circle centered on it:
>
>    fill(0.4)
>    ellipse(0, 0, 100, 100)
>    fill(0, 0, 0.4)
>    ellipse(0, 0, 50, 50)
>
> I'd propose one of these to activate it:
>
> placement(mode=CENTER)
> transform(placement=CENTER)
>
>
> Make sense ?
> (Maybe I'm missing something here, but drawing from the center seems a bit
> tricky right now)
>
> Maybe I should make a new shoebot grammar to add the placement command though as
> it's not strictly nodebox any more.
>
>  S++
>
>
I think that could only work for Ovals and Squares, how can you draw a
path from "the center"; an easier implementation would be to enhance
the Oval or Square function to draw from the center.
_______________________________________________
Shoebot-devel mailing list
[hidden email]
http://lists.tinkerhouse.net/listinfo.cgi/shoebot-devel-tinkerhouse.net
Reply | Threaded
Open this post in threaded view
|

Re: Placement from center

Stuart Axon
> From: Sebastian Oliva <[hidden email]>

> To: [hidden email]
> Sent: Sun, October 24, 2010 12:12:40 AM
> Subject: Re: [shoebot-devel] Placement from center
>
> On Fri, Oct 15, 2010 at 5:45 PM, Stuart Axon <[hidden email]> wrote:
> > The two  transform modes we have are well and good, but it would be really
>useful
> >  to have a placement mode that works like opengl, centered around the  
>current
> > position.
> >
> > This would mean that the following  would place a large circle, with a small
> > circle centered on  it:
> >
> >    fill(0.4)
> >    ellipse(0, 0, 100, 100)
> >     fill(0, 0, 0.4)
> >    ellipse(0, 0, 50, 50)
> >
> > I'd propose  one of these to activate it:
> >
> > placement(mode=CENTER)
> >  transform(placement=CENTER)
> >
> >
> > Make sense ?
> > (Maybe  I'm missing something here, but drawing from the center seems a bit
> >  tricky right now)
> >
> > Maybe I should make a new shoebot grammar to  add the placement command
>though as
> > it's not strictly nodebox any  more.
> >
> >  S++
> >
> >
> I think that could only work for  Ovals and Squares, how can you draw a
> path from "the center"; an easier  implementation would be to enhance
> the Oval or Square function to draw from  the center.

Centering already occurs in bezier path - their just re transformed so that
were based around the corner:

# Go to initial point (CORNER or CENTER):
transform = self._call_transform_mode(self._transform)

# Change the origin if nessacary
if self._get_pathmode() == CENTER:
    xc, yc = self._get_center()
    transform.translate(-xc, -yc)

The new parameter would probably affect the 2nd of these ifs.  The tricky bit
might be how the different CENTER/CORNER stuff interacts and whether it
makes sense.

> _______________________________________________
> Shoebot-devel  mailing list
> [hidden email]
> http://lists.tinkerhouse.net/listinfo.cgi/shoebot-devel-tinkerhouse.net
>


     
_______________________________________________
Shoebot-devel mailing list
[hidden email]
http://lists.tinkerhouse.net/listinfo.cgi/shoebot-devel-tinkerhouse.net
Reply | Threaded
Open this post in threaded view
|

Re: Placement from center

ricardo lafuente
In reply to this post by Stuart Axon
On 10/16/2010 12:45 AM, Stuart Axon wrote:

> The two transform modes we have are well and good, but it would be really useful
> to have a placement mode that works like opengl, centered around the current
> position.
>
> This would mean that the following would place a large circle, with a small
> circle centered on it:
>
>      fill(0.4)
>      ellipse(0, 0, 100, 100)
>      fill(0, 0, 0.4)
>      ellipse(0, 0, 50, 50)
>
> I'd propose one of these to activate it:
>
> placement(mode=CENTER)
> transform(placement=CENTER)
>
>
> Make sense ?
> (Maybe I'm missing something here, but drawing from the center seems a bit
> tricky right now)
>
> Maybe I should make a new shoebot grammar to add the placement command though as
> it's not strictly nodebox any more.

This sounds like it could be solved with functions similar to
Processing's rectMode() and ellipseMode(), see:
http://processing.org/reference/ellipseMode_.html
http://processing.org/reference/rectMode_.html

IIRC, i think Shoebot 0.3b has rectmode implemented.
I'm okay with adding this to the Shoebot grammar (+1 for keeping
separate from Nodebox), but this issue can also be dealt with with a few
translate() calls. I wonder what would be best: having the placement()
function, or a HOWTO on the docs on how to create paths originating from
the center.
_______________________________________________
Shoebot-devel mailing list
[hidden email]
http://lists.tinkerhouse.net/listinfo.cgi/shoebot-devel-tinkerhouse.net
Reply | Threaded
Open this post in threaded view
|

Re: Placement from center

Stuart Axon
> From: ricardo lafuente <[hidden email]>

> To: [hidden email]
> Sent: Sun, October 24, 2010 4:22:40 PM
> Subject: Re: [shoebot-devel] Placement from center
>
> On 10/16/2010 12:45 AM, Stuart Axon wrote:
> > The two transform modes we  have are well and good, but it would be really
>useful
> > to have a  placement mode that works like opengl, centered around the
current

> >  position.
> >
> > This would mean that the following would place a large  circle, with a small
> > circle centered on it:
> >
> >       fill(0.4)
> >      ellipse(0, 0, 100,  100)
> >      fill(0, 0, 0.4)
> >       ellipse(0, 0, 50, 50)
> >
> > I'd propose one of these to activate  it:
> >
> > placement(mode=CENTER)
> >  transform(placement=CENTER)
> >
> >
> > Make sense ?
> > (Maybe  I'm missing something here, but drawing from the center seems a bit
> >  tricky right now)
> >
> > Maybe I should make a new shoebot grammar to  add the placement command
>though as
> > it's not strictly nodebox any  more.
>
> This sounds like it could be solved with functions similar to
> Processing's rectMode() and ellipseMode(),  see:
> http://processing.org/reference/ellipseMode_.html
> http://processing.org/reference/rectMode_.html
>

how about just pathMode() ?  
- Seems like it could be more general, and the name is probably
better than placement I came up with.


> IIRC,  i think Shoebot 0.3b has rectmode implemented.
> I'm okay with adding this to  the Shoebot grammar (+1 for keeping
> separate from Nodebox), but this issue  can also be dealt with with a few
> translate() calls. I wonder what would be  best: having the placement()
> function, or a HOWTO on the docs on how to  create paths originating from
> the  center.
> _______________________________________________
> Shoebot-devel  mailing list
> [hidden email]
> http://lists.tinkerhouse.net/listinfo.cgi/shoebot-devel-tinkerhouse.net
>


     
_______________________________________________
Shoebot-devel mailing list
[hidden email]
http://lists.tinkerhouse.net/listinfo.cgi/shoebot-devel-tinkerhouse.net
Reply | Threaded
Open this post in threaded view
|

Re: Placement from center

Stuart Axon
> From: Stuart Axon <[hidden email]>

> To: [hidden email]
> Sent: Sun, October 24, 2010 4:31:09 PM
> Subject: Re: [shoebot-devel] Placement from center
>
> > From: ricardo lafuente <[hidden email]>
>
> > To: [hidden email]
> >  Sent: Sun, October 24, 2010 4:22:40 PM
> > Subject: Re: [shoebot-devel]  Placement from center
> >
> > On 10/16/2010 12:45 AM, Stuart Axon  wrote:
> > > The two transform modes we  have are well and good, but  it would be really
>
> >useful
> > > to have a  placement mode  that works like opengl, centered around the
> current
> > >   position.
> > >
> > > This would mean that the following would  place a large  circle, with a
>small
> > > circle centered on  it:
> > >
> > >       fill(0.4)
> > >       ellipse(0, 0, 100,  100)
> > >       fill(0, 0, 0.4)
> > >       ellipse(0, 0, 50, 50)
> >  >
> > > I'd propose one of these to activate  it:
> >  >
> > > placement(mode=CENTER)
> > >   transform(placement=CENTER)
> > >
> > >
> > > Make sense  ?
> > > (Maybe  I'm missing something here, but drawing from the  center seems a
>bit
> > >  tricky right now)
> > >
> >  > Maybe I should make a new shoebot grammar to  add the placement  command
> >though as
> > > it's not strictly nodebox any   more.
> >
> > This sounds like it could be solved with functions  similar to
> > Processing's rectMode() and ellipseMode(),   see:
> > http://processing.org/reference/ellipseMode_.html
> >  http://processing.org/reference/rectMode_.html
> >
>
> how about just  pathMode() ?  
> - Seems like it could be more general, and the name is  probably
> better than placement I came up with.
>
Thinking about it maybe pathMode CENTER would imply mode CENTER ?

>
> > IIRC,  i  think Shoebot 0.3b has rectmode implemented.
> > I'm okay with adding this  to  the Shoebot grammar (+1 for keeping
> > separate from Nodebox),  but this issue  can also be dealt with with a few
> > translate()  calls. I wonder what would be  best: having the placement()
> >  function, or a HOWTO on the docs on how to  create paths originating from
> > the  center.
> >  _______________________________________________
> > Shoebot-devel   mailing list
> > [hidden email]
> >  http://lists.tinkerhouse.net/listinfo.cgi/shoebot-devel-tinkerhouse.net
> >
>
>
>      
> _______________________________________________
> Shoebot-devel mailing  list
> [hidden email]
> http://lists.tinkerhouse.net/listinfo.cgi/shoebot-devel-tinkerhouse.net
>


     
_______________________________________________
Shoebot-devel mailing list
[hidden email]
http://lists.tinkerhouse.net/listinfo.cgi/shoebot-devel-tinkerhouse.net
Reply | Threaded
Open this post in threaded view
|

Re: Placement from center

ricardo lafuente
On 10/24/2010 05:35 PM, Stuart Axon wrote:
>> how about just  pathMode() ?
>> - Seems like it could be more general, and the name is  probably
>> better than placement I came up with.

True, but how would rectmode/ellipsemode be adapted to bezier paths in
general?

Would this mean that the coords end up being relative to a center? I'm
still trying to wrap my head around this.

I think i mixed up two different concepts by relating your proposal to
Processing's rectMode/ellipsemode. Recapping:

rectMode and ellipseMode set what arguments rect() and ellipse() should
expect:
- CORNER (default): (x, y, width, height)
with (x, y) being the absolute coords of the top-left corner, unless you
use negative values for with and/or height -- e.g. with negative width
and height, (x,y) ends up being the bottom-left corner).
- CENTER: (cx, cy, width, height)
with (cx, cy) being the absolute coords of the CENTER of the
rectangle/ellipse. Width and height work the same as above.
- CORNERS: (x1, y1, x2, y2)
with (x1, y1) being the absolute coords of a corner, and (x2, y2) the
coords of the opposite corner.

On the other hand, your placement() concept would be more useful to
place paths relative to another point, if i understood correctly. This
can be easily achieved with translate(), isn't that so?
Since i'm unacquainted with OpenGL nitty-gritty, i'm not sure i got it,
so apologies in advance if this confusion is my fault.

> Thinking about it maybe pathMode CENTER would imply mode CENTER ?

You mean transformmode CENTER?

_______________________________________________
Shoebot-devel mailing list
[hidden email]
http://lists.tinkerhouse.net/listinfo.cgi/shoebot-devel-tinkerhouse.net