Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #39942

Looking for curve generating functionality

From Jeff Higgins <jeff@example.com>
Newsgroups comp.lang.java.programmer
Subject Looking for curve generating functionality
Date 2023-04-12 00:53 +0000
Organization A noiseless patient Spider
Message-ID <u14ve4$2o5pr$1@dont-email.me> (permalink)

Show all headers | View raw


Hi all.
I am investigating the problem of solving jigsaw puzzles.
So, to start, I need to generate jigsaw puzzles. I found the
article "Generating SVG Jigsaw Puzzles" and am currently using
the given code to generate puzzles and their pieces. The given
code is written in javascript. The article located at
https://dev.inventables.com/2016/02/26/generating-svg-jigsaw-puzzles.html
and is well written, ad-free, and contains all source code.

My first instinct was to translate the code to Java, but was
stopped almost immediately for the lack of a curve generating
function that is supplied in the javascript library D3.js used
in the article, but not in java.awt.geom. The author describes
this curve as a "B-spline, with control point duplication on the ends".
The article contains a nice interactive demo of the curve.

So my workflow at present is generate the puzzle pieces using
the given javascript, output SVG, use the Java Batik library
to convert the SVG to java.awt.geom.Path2d objects. Messy.

The paths produced by this contain five CubicCurve2d segments
and determining the needed parameters is considerably more complex.
I haven't been able to easily and reliably duplicate the
functionality in Java.

My math skills are not up to the task of understanding splines
so searching the web produces mostly content that I am  not able
to consume. Adding Java to the search terms hasn't been much help.

I am hoping that someone will take the interest to glance at the
article and be able to some suggest some available Java functionality
to replace the D3.js functionality.

Thanks much in advance.
Jeff Higgins

Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Looking for curve generating functionality Jeff Higgins <jeff@example.com> - 2023-04-12 00:53 +0000
  Re: Looking for curve generating functionality Jeff Higgins <jeff@example.com> - 2023-04-12 04:06 +0000
    Re: Looking for curve generating functionality Arne Vajhøj <arne@vajhoej.dk> - 2023-04-16 20:00 -0400

csiph-web