[Ipe-discuss] N marks uniformly sampled on a circle ?

Soeren Nickel soeren.nickel at ac.tuwien.ac.at
Sun Mar 27 16:37:19 CEST 2022


Hi Pierre,

About distributing Points equally around a circle. I had a look at the 
C++ ipelet kgon.cpp (which is part of ipe itself), since that already 
does all the computation and simply added a couple of lines also putting 
points at the corners. I attached the .cpp ipelet, the .lua wrapper and 
the makefile, all three of which are almost identical to the original 
ipelet.

For Ubuntu:

If you download the ipe source from the website, navigate to the folder 
ipe-7.2.24/src/ipelets then create a folder ("kgonpoints") and put the 
three attached files in there, then you can simply call make, which will 
create the following file: ipe-7.2.24/build/ipelets/kgonpoints.so

Copy the lua wrapper and the kgonpoints.so file into a folder, where ipe 
will look for ipelets (for me that is ~/.ipe/ipelets). Now restart ipe 
and you should have an ipelet, which does everything the kgon ipelet 
did, but also places points on the corners.

Note: I am not particularly experienced in writing ipelets or C++, so I 
just looked for the least invasive solution. I am sure you can do that 
in a nicer way instead of hijacking the kgon ipelet. I also created the 
new ipelet in the same spot as the old ipelet, to be able to reuse the 
make file, which already existed, only changing the names of the files. 
The description text in the lua wrapper is also almost identical.

Hope that helps,
Soeren

On 27.03.22 15:06, Sebastien Loriot via Ipe-discuss wrote:
> For the ipelet, could you share the file so that I can try to reproduce?
> Or even better, open an issue in the CGAL tracker.
>
> Best,
>
> Sebastien.
>
> On 3/15/22 12:21, Pierre Alliez via Ipe-discuss wrote:
>> dear colleagues,
>>
>> I was unable to find an easy way to automatically sample marks on a 
>> circle, uniformly. I found the ipelet regular N-gon in the goodies, 
>> but then need to add the marks manually. my goal is then to compute 
>> the Delaunay triangulation of all points sampled on concentric 
>> circles (image below).
>>
>> separate issue: the Delaunay ipelet crashes on windows if I do not 
>> add as marks the 4 corners of the bounding box below.
>>
>> any advice would be appreciated,
>>
>> Pierre
>>
>> -- 
>> Pierre Alliez
>> Head of science, team leader
>> Inria Centre at Université Côte d'Azur
>> Editor in Chief, Computer Graphics Forum
>> http://www-sop.inria.fr/members/Pierre.Alliez/
> _______________________________________________
> Ipe-discuss mailing list
> Ipe-discuss at lists.science.uu.nl
> https://mailman.science.uu.nl/mailman/listinfo/ipe-discuss
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kgonpoints.cpp
Type: text/x-c++src
Size: 3659 bytes
Desc: not available
URL: <https://mailman.science.uu.nl/pipermail/ipe-discuss/attachments/20220327/1104bdf9/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kgonpoints.lua
Type: text/x-lua
Size: 1870 bytes
Desc: not available
URL: <https://mailman.science.uu.nl/pipermail/ipe-discuss/attachments/20220327/1104bdf9/attachment-0001.bin>
-------------- next part --------------
# --------------------------------------------------------------------
# Makefile for kgon ipelet (an example of a C++ ipelet)
# --------------------------------------------------------------------

IPESRCDIR = ../..
OBJDIR = $(BUILDDIR)/obj/ipelets
DEPEND = $(OBJDIR)/kgon.depend
include ../../common.mak

TARGET = $(call ipelet_target,kgonpoints)
LUASCRIPT = kgonpoints.lua

CPPFLAGS += -I../../include
LIBS += -L$(buildlib) -lipe
CXXFLAGS += $(DLL_CFLAGS)

all: $(TARGET)

sources	= kgonpoints.cpp

$(TARGET): $(objects)
	$(MAKE_IPELETDIR)
	$(CXX) $(LDFLAGS) $(PLUGIN_LDFLAGS) -o $@ $^ $(LIBS)

clean:
	@-rm -f $(objects) $(TARGET) $(DEPEND)

$(DEPEND): Makefile
	$(MAKE_DEPEND)

-include $(DEPEND)

install: $(TARGET)
	$(INSTALL_DIR) $(INSTALL_ROOT)$(IPELETDIR)
	$(INSTALL_PROGRAMS) $(TARGET) $(INSTALL_ROOT)$(IPELETDIR)
	$(INSTALL_FILES) $(LUASCRIPT) $(INSTALL_ROOT)$(IPELETDIR)

# --------------------------------------------------------------------


More information about the Ipe-discuss mailing list