UIBezierPath find cross points / get all points - uibezierpath

Is there any way to get all crossing points of lines created using UIBezierPaths?
I could also imagine a solution where I get all points inside the UIBezierPath and check them one after the other...
Thanks, kind regards, Julian

I get all the points of a UIBezierpath on this sample code, there is a mathematical approach for it and you need to know key points of the curve , this example probably will help you ,
you can take a look at :
Curvy UISlider
I will try to update it soon.

Related

ST_AREA is not enough precise

I am trying to save polygon area when a new polygon has been created by the user. I found that there is a function for this purpose - ST_AREA, but when I check if it is calculating correct I find some discrepancies. Here is one example:
This is one polygon which area according to geojson.io is 31.85:
But when I run ST_AREA for the same polygon:
SELECT ST_Area(CONCAT(a.polygon, 'SRID=4326'))*10000 AS area FROM kt_polygons a where polygon_id = 180;
The result is 34.93261884737489. Something more, I am not quite sure why I multiply the result area by 10000.. I just do that because the result seems to be more realistic in that way.
I check some other polygons and the difference is not more than 5, but why this can happen? Any ideas what I do wrong?
I found a solution which helps for my case. When I get the result from ST_Area I multiply it by 9090,91. This coefficient maybe is propriate only for my problem, but you can find if there is dependency between the real areas and the one from ST_Area. If so, you can find your coefficient.

X and Y coordinates in R. Is there an obvious way to remove data that is a certain radius away from a given point?

I am trying to clean up some eye tracking data in which people are told to focus on the middle of the screen. However, the data is somewhat noisy and I am trying to clean it up in a proper way.
I have created some code that emulates the kind of data that I have and the methods I am trying to use as well as what I am presenting below.
The data complete with noise looks as follows:
I have tried to use a simple formula to throw all samples further than some pixels from the centre away such as:
results[results$x <= xmid+threshold & results$x >= xmid-threshold,]
But that results in data in a square shape rather than a circle:
I have tried to think about what to do here and have made it as far as to define a circle that encompasses the area that I am interested in:
However, I can not see a straightforward way to only pick data within that area.The solutions I have tried have required several for loops and still not given me the result I was hoping for.
I hope that some of you can point me in the right direction here. Maybe the problem is even trivial to solve in some manner that I have not yet considered? Thanks for reading this far and here is the code if you think that you can help :)
To check whether point lies in circular region with radius threshold around center xmid, ymid, you can use expression (^ denotes 2-nd power, squaring)
(x-xmid)^2 + (y-ymid)^2 <= threshold^2

get all the harmonics from a wave

I need to filter the harmonics of an audio track using the libraries 'seewave' and 'tuneR' of R, but I do not know the functions of this language well.
So far I have done the following:
library('seewave')
library('tuneR')
track<-readMP3('empty_spaces.mp3')
t1<-cutw(track, from=0, to=10)
autoc(t1, f=4400)
and the result is the next screen:
at first I thought that the group of points on the bottom were the harmonics and the points isolated above belonged to noise, but I think I'm not interpreting it well. Could someone help me interpret this image? or tell me what function would help me get what I need?
Thank you
This is image of distribution of frequencies across time, so by this image it s hard to see, where noise and where useful signal. To solve your problem, you should use frequency filters , chebyhev or butterworth filters (look at filter function in signal package) and of course you must know what frequencies you want to delete.

Definition of singly-connected set

please - help - what does mean singly-connected set? this is set without holes and which has one bounded contour? the sample http://doc.cgal.org/latest/Straight_skeleton_2/index.html#Chapter_2D_Straight_Skeleton_and_Polygon_Offsetting means that this is set of another structure or this docs has mistake?
At least in the Straight skeleton package it means that if you strip off the boundary of the polygon, any two points of the open polygon can be connected with a curve inside the open polygon.

How can I segment a cloud if I know the rough shape it has to have?

I am trying to segment this 3D point cloud (this is the view at the top):
I want the "inner ellipsis", basically excluding the long red line on the right and some of the other points that stick out too much from the red ellipsis.
How/can I do this with PCL?
I would suggest using RANSAC but creating your own "elipse" model similar to the models used here: http://docs.pointclouds.org/trunk/a02954.html. Having done that I am sure it could be of benefit to others too.
Take a look at the code for e.g. SampleConsensusModelPlane or SampleConsensusModelCylinder for an idea how to build such a model:
$ cd ~/software/pcl
$ find . -name "sac_model_cylinder*"
./sample_consensus/src/sac_model_cylinder.cpp
./sample_consensus/include/pcl/sample_consensus/impl/sac_model_cylinder.hpp
./sample_consensus/include/pcl/sample_consensus/sac_model_cylinder.h
Well, that's probably how I would do it (I haven't done it).
I would try RANSAC first, and then play with the parameters of the algorithm.
You can also try filtering the cloud a bit (again, try to play with parameters):
http://pointclouds.org/documentation/tutorials/remove_outliers.php#remove-outliers
http://pointclouds.org/documentation/tutorials/statistical_outlier.php#statistical-outlier-removal
If you know the radius of a rough circle that you are interested the data inside, why don't you apply a pass through filter to remove the unwanted parts. Check this link.
Pass through filter can be applied to different fields (x,y,z) and also to colors in RGB or HSI color space ranges.

Resources