what is equal to java path.quadto in firemonkey? - firemonkey

I designed a paint app in android studio for freehand drawing.
I wonder if there is a way make 'path.quadto(p1,P2)' in delphi 10.4 pr xe8.
the problem is there are too many, but none of them give the same result on android.
'path.curveto(p1,p2,p3);'
'path.smoothcurveto(p2,p3);'
'Path.quadcurveto(p2,p3);'
If two points have distance greater than the tolerance then I use 'path.quadto' in java, but I can't do that in firemonkey.
It always draws lines.

FMX uses only cubic Beziers, but you can always compute a cubic from a quadratic (you can't always go the other way). Just use the equations given in the following link.
Convert a quadratic bezier to a cubic one

Related

Distance to horizon with terrain elevation data

Looking for an algorithm to compute actual distance from a latitude/longitude/elevation to the visible horizon taking into account the actual surrounding terrain and the curve of the earth. Assume you have enough terrain data for the surrounding several hundred miles from any of the open elevation datasets. The problem can be simplified to an approximate by checking a few cardinal directions. Ideally I'd like to be able to compute the real solution as well.
Disclosure: I'm the developer and maintainer of the below mentioned software package.
I'm not sure if you're still looking for a solution as this question is already a bit older. However, one solution for your problem would be to apply the open-source package HORAYZON (https://github.com/ChristianSteger/HORAYZON). It's based on the high-performance ray tracing library Intel Embree (https://www.embree.org) and thus very fast and it considers Earth's curvature. With this package, you can compute the horizon angle and the distance to the horizon line for one or multiple arbitrary location(s) on a Digital Elevation Model (DEM) and set various options like the number of cardinal sampling directions, the maximal search distance for the horizon, etc. However - I'm not sure what you mean by "real solution". Do you mean the "perfect" solution - i.e. by considering elevation information from all DEM cells without doing a discrete sampling along the azimuth angle? Unfortunately, this cannot be done with the above mentioned package (but one could theoretically implement it).

Excel chart smoothing algorithm

I need to smooth my "chart builder" programmically in javascript. Excel variant of doing it is pretty good but I have no suggestion of what algorithm used. I try to get VBA code of doing it by writing macros but all I have got is (expected) ActiveChart.SeriesCollection(1).Smooth = True
Is anybody know what algorithm does Microsoft Excel use to smooth chart or the way of looking its code?
UPD: for those who find this question and have the same problem i can recommend this SVG solution with javascript source code
Splines are used to do this:
http://en.wikipedia.org/wiki/Spline_interpolation
I'm not sure if Excel uses exactly this but cubic splines are often used for this kind of 'join the dots' problem. Essentially you fit a set of cubic polynomials (i.e. a set of cubic equations) through the points. Each cubic is used for one or two regions bounded by two or three points. The cubics are defined by preserving not only the value but the gradient at each point where one cubic finishes and the next one starts. Quite often the second derivative is set to zero which gives you another boundary condition and better smoothness.

How to detect a Triangle gesture with kinect?

I am trying to implement a gesture recognition system which interprets the geometric gestures user makes and draws it on screen,
I have some idea of how circle can be recognized, however I have no clue how to get started with triangle recognition.
The data I have is X and Y coordinates of all points the gesture passed through. I get this data by tracking right hand.
I found something online called Hough Transform, which is used for detecting lines but I am not sure whether it will work for discrete collections of points.
Any ideas folks?
If you already have an x,y pair for the hand, the simplest thing that comes to mind is try the $1 Unistroke Recognizer.
A handy thing to look at is Dynamic Time Warping(DTW).
I've seen a fun Processing/SimpleOpenNI project that makes
use of that technique and the full skeleton called KineticSpace.
Since it's open-source might be worth having a peak.
I'd recommend trying the $1 Unistroke Recognizer first. You probably
need to work out a system to mimic press/release (perhaps using
the sign of the hand's velocity on z (positive to negative transitions/
negative to positive transitions) ?).
HTH
You can look for a space filling curve. It reduces the 2 dimension and reorder the points. It also add some spatial information. Maybe you can train or compare the new reordered 1d index with some simulated annealing or ant colony optimization?! A space filling curve is used in map tiling programs.

3D Matrices - How to "Wobble" an object?

I'm trying to make a 3D object do a wobble effect, very much like a boss in StarFox 64 did when it teleported (see this video at 5:17 for reference). This seems like either a skewing effect, or perhaps an un-uniform scale that rotated around and was applied without rotating the object itself.
Does anyone have any idea how this might be done, or perhaps does anyone have any links to programs where I can play with the matrices directly to see how this is done?
You can use skew based on roll axis in the Euler angles coordinate system
See Euler angles
http://en.wikipedia.org/wiki/Euler_angles
Euler angles-matrix transformation ("General rotations" part of the article):
http://en.wikipedia.org/wiki/Rotation_matrix
An euler angles-matrix conversion utility in DirectX SDK
http://msdn.microsoft.com/en-us/library/microsoft.windowsmobile.directx.matrix.rotationyawpitchroll%28v=VS.85%29.aspx
And threads about skew matrices
skew matrix algorithm
http://www.quantunet.com/flash8/knowledgebase/actionscript/advanced/matrix/matrix_skew.html

Library for generating cubic spline trajectories (not interpolation)?

A little background. I have a simulation that uses cubic splines for 1D trajectories. In this context, a cubic spline specifies an object's position, velocity, acceleration, and jerk as a function of time.
If you have:
initial and final values for
position, velocity, acceleration, and
time
constant-value constraints on
the maximum and minimum velocity,
acceleration, and jerk
then there is a unique spline. If you don't specify the final time, but instead want the minimum-time trajectory, then there is also a unique spline.
Actually finding these splines can be a royal pain, though. In the case where time is specified, a spline will consist of up to 7 polynomials, and the knots (transition points between polynomials) aren't known ahead of time.
This is not the usual case of fitting a spline to a set of data, it's creating splines from the boundary conditions and some additional constraints. I've read papers where people have used similar arrangements and have had similar needs, but I've never found any libraries (or even source code) that tackles generating splines of this sort. I've written some code that handles most cases, but it isn't terribly robust or fast. I'm not very worried about it being fast, but more robust would be great.
Are there any libraries that can do this available? Open source code, even if not built as a library? C, C++, Java, or Python preferred, but if it's open source other languages would still be useful as a reference.
There is a boost library for C++ that is open source and might get you half-way there.
It has all the basic building blocks you need I think (Legrendre/Laguerre/Hermite polynomials, root finding, etc...), though it comes short of actually calculating splines.
The library documentation is here so you can check for yourself: http://www.boost.org/doc/libs/1_45_0/libs/math/doc/html/index.html
The problem with splines is that you have to solve simultaneous linear equations to solve the conditions. If your situation has any more information about some of those derivatives, you may be able to use Piecewise Cubic Hermite Interpolation (PCHIP).
For example, instead of defining that jerk must be zero, you could come up with a different constraint, use PCHIP, and solve your problem greedily. Anyway, it's something to remember even if you can't use it this time.
http://www.mathworks.com/moler/interp.pdf
SciPy's interpolation functions might help... Plus you can get the derivatives or integrals of those splines easily... I'm not sure why you say "not interpolation"... It seems to me like that is what you are trying to accomplish.

Resources