Re: How to "reverse" the arc, when creating a shape?

Wojciech Zabolotny <[email protected]>
Newsgroups gmane.comp.graphics.ipe.general
Message-ID <CAMduVEcHNZ6tyEK1XQE-yesURdxDB5JPUn6DoQz2kE12Tq04VQ@mail.gmail.com>
2015-08-23 14:45 GMT+02:00 Otfried Cheong <[email protected]>:
>
>
> On Sun, Aug 23, 2015, at 17:56, Wojciech Zabolotny wrote:
>> Is there any way to generate the arc covering the right range of
>> angles but in reversed direction?
>
> An arc is always counter-clockwise on its supporting unit circle.  To
> get a clockwise arc, you need to change the matrix so that it mirrors
> this circle.  (E.g. negate the change the first element.)
>

Thanks, I've modified my source accordingly (see attached kolka9.lua script),
and now the objects are generated correctly.

Thanks, Wojtek

_______________________________________________
Ipe-discuss mailing list
Ipe-discuss-rGrgPyRx506NN8uzcEdRPYRWq/[email protected]
http://lists.science.uu.nl/mailman/listinfo/ipe-discuss
kolka9.lua (text/x-lua, 684 B)
doc=ipe.Document()
page=doc[1] ; -- Get the first page
l=page:layers()[1] -- Get the first layer
p = ipe.Direction((90.0-35.0)*math.pi/180.0)
q = ipe.Direction((90.0+35.0)*math.pi/180.0)
for i=5,10 do
 f1=(i-0.2)*5.0
 f2=(i+0.2)*5.0
 m1=ipe.Matrix(f1,0,0,f1)
 m2=ipe.Matrix(-f2,0,0,f2)
 ps={}
 ps["stroke"]="black"
 shape={}
 arc1 = { type="arc", arc=ipe.Arc(m1, p, q), m1*p, m1*q }
 seg1 = { type="segment", m1*q, m2*p}
 arc2 = { type="arc", arc=ipe.Arc(m2, p, q), m2*p, m2*q }
 seg2 = { type="segment", m2*q, m1*p}
 subpath = { type="curve", closed=true, arc1, seg1, arc2, seg2}
 shape = { subpath }
 obj = ipe.Path(ps, shape)
 page:insert(nil,obj,nil,l)  
end
doc:save("test.pdf")
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.