How to "reverse" the arc, when creating a shape?
Wojciech Zabolotny <[email protected]>
| Newsgroups | gmane.comp.graphics.ipe.general |
|---|---|
| Message-ID | <CAMduVEd7sz+tPPskeOm0_Q+hjvuWXnd+wHbTM4LO5pYbcr2n0w@mail.gmail.com> |
Hi, I wanted to create a figure consisting of a few connected arcs. The attached "kolka7.lua" script demonstrates the desired operation. however I wanted to create each object consisting of two connected arcs as a single path, and here I run into problems. The script kolka6.lua works correctly, but the second arc covers incorrect range of angles. The script kolka6b generates correct arcs, but due to mismatched start and end points it generates an error: $ ipescript kolka6b Assertion failed on line #322 (ipeshape.cpp): 'v0 == iCP.back()' Is there any way to generate the arc covering the right range of angles but in reversed direction? Or may be I can simply reverse the generated arc so that start and end points are swapped? -- Thank you very much in advance, With best regards, Wojciech M. Zabołotny My GPG/PGP keys: standard: 8192R/FE58A848 (0720 9430 85DB 7CCD F4C5 5F1E 5107 91FB FE58 A848) confidential: 16384R/C76D2FB0 (C4E7 9597 CF22 7B5D 28BF 4656 FED7 A63F C76D 2FB0) _______________________________________________ Ipe-discuss mailing list Ipe-discuss-rGrgPyRx506NN8uzcEdRPYRWq/[email protected] http://lists.science.uu.nl/mailman/listinfo/ipe-discuss
kolka6.lua
(text/x-lua, 673 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"
arc1 = { type="arc", arc=ipe.Arc(m1, p, q), m1*p, m1*q }
seg1 = { type="segment", f1*q, f2*q}
arc2 = { type="arc", arc=ipe.Arc(m2, q, p), m2*q, m2*p }
seg2 = { type="segment", f2*p, f1*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")
kolka6b.lua
(text/x-lua, 673 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"
arc1 = { type="arc", arc=ipe.Arc(m1, p, q), m1*p, m1*q }
seg1 = { type="segment", f1*q, f2*q}
arc2 = { type="arc", arc=ipe.Arc(m2, p, q), m2*p, m2*q }
seg2 = { type="segment", f2*p, f1*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")
kolka7.lua
(text/x-lua, 1 KB)
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"
arc1 = { type="arc", arc=ipe.Arc(m1, p, q), f1*p, f1*q }
subpath = { type="curve", closed=false, arc1}
shape = { subpath }
obj = ipe.Path(ps, shape)
page:insert(nil,obj,nil,l)
seg1 = { type="segment", f1*q, f2*q}
subpath = { type="curve", closed=false, seg1}
shape = { subpath }
obj = ipe.Path(ps, shape)
page:insert(nil,obj,nil,l)
arc2 = { type="arc", arc=ipe.Arc(m2, p, q), f2*p, f2*q }
subpath = { type="curve", closed=false, arc2}
shape = { subpath }
obj = ipe.Path(ps, shape)
page:insert(nil,obj,nil,l)
seg2 = { type="segment", f2*p, f1*p}
subpath = { type="curve", closed=false, seg2}
shape = { subpath }
obj = ipe.Path(ps, shape)
page:insert(nil,obj,nil,l)
end
doc:save("test.pdf")