Hi,
I'm trying to make a filled shape using paths - a kind of elephant's trunk shape. I'm tracing it out using the following:
path trunk {
STROKE {width 0.01}
MOVETO {x 0 y -1}
ARCTO {x 0 y 0 r 0.7}
// CLOSEPOLY {}
MOVETO {x 0 y -0.8}
ARCTO{x 0 y -0.3 r 0.5}
MOVETO {x 0 y 0}
LINETO {x 0 y -0.3}
MOVETO {x 0 y -0.8}
LINETO {x 0 y -1}
// FILL {}
}
With FILL {} commented out, it renders the shape I want. If I un-comment FILL {}, I get a flat-sided shape which doesn't correspond to what I traced out - the left-hand side is flat. (Which is the same as un-commenting the CLOSEPOLY {} and commenting the subsequent commands out apart from FILL {}.)
What am I doing wrong? Presumably the software doesn't perceive the boundaries of the shape in the same way as I do. How, if at all, can I make it fill the shape?
Any help is much appreciated!
Thanks a lot,
Ben.
Problem with paths and filling
Moderators: MtnViewJohn, chris, mtnviewmark
- MtnViewJohn
- Site Admin
- Posts: 882
- Joined: Fri May 06, 2005 2:26 pm
- Location: Mountain View, California
- Contact:
The STROKE command belongs after the path operation: It is possible to have your shape be a single, connected closed path with miter joins. But you have to make the smaller arc draw clock-wise instead of the default counter-clock-wise:
Code: Select all
path trunk {
MOVETO {x 0 y -1}
ARCTO {x 0 y 0 r 0.7}
// CLOSEPOLY {}
MOVETO {x 0 y -0.8}
ARCTO{x 0 y -0.3 r 0.5}
MOVETO {x 0 y 0}
LINETO {x 0 y -0.3}
MOVETO {x 0 y -0.8}
LINETO {x 0 y -1}
STROKE {width 0.01}
}
Code: Select all
path trunk {
MOVETO {x 0 y -1}
ARCTO {x 0 y 0 r 0.7}
LINETO {x 0 y -0.3}
ARCTO {x 0 y -0.8 r 0.5 p cw}
CLOSEPOLY{}
STROKE {width 0.01}
}
- MtnViewJohn
- Site Admin
- Posts: 882
- Joined: Fri May 06, 2005 2:26 pm
- Location: Mountain View, California
- Contact: