[Ipe-discuss] Get point coordinates in ipelets.
rote at inf.fu-berlin.de
Tue Mar 16 15:02:27 CET 2010
> From: "Sebastien Loriot (GeometryFactory)" <sloriot.ml at gmail.com>
> Subject: Re: [Ipe-discuss] CGAL points generator ipelets in Ipe 7
>> I'm writing an Ipelet in Lua that uses a set of points (markers) as
>> input. I sort the points using their x coordinate, which I obtain using
>> the getPosition() function of each marker object.
>> Â¿Does anybody have any idea of why this happens?, Â¿Are not all the
>> objects on a page referenced to the same coordinate system?
> Just a hint: ... You probably should have a
> look at the matrix() function of ipe::Object.
Here is an ipelet print.lua that dumps the coordinates of a group of points
to the terminal (written for my own convenience), assuming
that you start ipe from the command line.
It seems to work fine.
written by Günter Rote, 2010
label = "print point coordinates"
about = [[
Dump coordinates of a point set
This ipelet is part of Acrobat Reader.
local function incorrect_input(model,s)
model:warning("Cannot find coordinates", s)
local function getpoints(model,obj,which)
if obj:type() ~= "group" then
incorrect_input(model, which .. " selection is not a group")
for i,point in ipairs(obj:elements()) do
if point:type() ~= "reference" or point:symbol():sub(1,5) ~= "mark/" then
incorrect_input(model, which .. " selection is not a group of points")
marks[#marks + 1] = obj:matrix() * point:position()
local p = model:page()
local prim = p:primarySelection()
-- get the data
local p = getpoints(model,p[prim],"first")
if not p then
-- now print the data
for i,ps in ipairs(p) do
print ("("..ps.x..","..ps.y .."),")
run = match
G"unter Rote (Germany=49)30-838-75150 (office)
Freie Universit"at Berlin -75103 (secretary)
Institut f"ur Informatik FAX (49)30-838-75192
More information about the Ipe-discuss