FlorisSteenkamp/MAT

how the boundary curve are represented?

Closed this issue · 37 comments

how the boundary curve are represented, you have referred a paper where the boundary is represented in the format of analytic curves , but in vector graphics which converts the boundaries to quadratic bezier curves

Bezier curves are analytic (basically, differentiable) nearly everywhere except at finitely many points. Is that what you are asking?

no sir , -----> "http://home.iitk.ac.in/~jrkumar/download/ME761A_Lecture-3%20Curve%20representation.pdf"
here bezier curve comes under synthetic curves, isn't analytic curves just lines and conic segments sir
and thanks for quick response, I have been reading line by line in your github, I am having few doubts is it ok to ask here in the issues or can i contact you by getting your mail id sir,

I'll explain to you tomorrow morning. It's a bit late here and hard for me to type on my phone only. It will all be clear to you soon! In the meantime, analytic in the paper refers to the usual definition of differentiability of the boundary curves so that tangents, normals, curvature, etc can be calculated at each point of the curves.

Unfortunately, in the link you gave me, 'analytic vs synthetic curves', analytic very confusingly means something different - it just refers to a rather arbitrary classification of curves and should not be taken too seriously at all.

You can read more about analytic functions on Wikipedia. But for now just think of it as the ability to differentiate at a point. Circles, Conics, Splines (including beziers), etc are all 100% analytic in this usual sense.

Please feel free to ask if it is still unclear.

sure sir , thanks sir for your help, within morning I would make sure to understand it completely , ask few more doubts sir

I'll be closing the issue for now. If you have more questions I also recommend you ask on Stack Overflow or math.stackexchange.com.

sir are you discretizing the boundary ,and then at each point finding the ball's center which is located in inward normal and noting the nearest point of the other end and storing it as a array, repeting the task and noting all the boundary point and sticthing the center points?

"... how can they increment centre for next centre ..."

Good question!

In the paper they say (on p. 473): "... Let us draw a circle Ba1(x1) containing z on its boundary such that x1 ∈ xy ..."

You are asking how to get from x to x1 (and then x2, etc.). They don't say this in the paper but here's how: from x go toward y by staying on the line xy until the distance from y and z to x are eqaual, i.e. until d(x,y) = d(x,z). This is the new x1. Then again find the new closest points from the new x1 to the two boundaries and repeat the process: x -> x1 -> x2 -> x3 -> ... This sequence converges to the correct x.

"... i am trying to implement it from the scratch independently ..." I would like to warn you that this is known to be very hard to implement. If you insist it may be a good idea to start with shapes with only straight line boundaries to simplify the math and then go from there.

"... Ω - domain but what is ∂Ω ..."

They clearly say in the paper "Ω is the closure of a connected bounded open subset in R²". This means that Ω could be for example a disk. ∂Ω is simply the boundary curves of Ω, in other words, in our case, the closed loop of piecewise bezier curves. In the example mentioned previously this would be the circlular boundary of the disk. (Note however that circles cannot be represented by polynomial bezier curves - only by rational bezier curves.)

"... are you growing the circles from boundary similar to below ..."

Yes, very similar except the circles are shrunk (as in the video), not grown.

"... CP graph do you mean constraint programming ..."

No. By CP graph (short for Contact Point Graph) I mean the graph (or tree if the shape (∂Ω) is a Jordan Curve) formed by the Medial Axis (MA) if the bifurcation points (3+ prong points) are viewed as vertices and the curves connecting the bifurcation points are viewed as edges. It is very important here to understand that a "Contact Point" directly represents a point on the MA via the center of the MAT circle at the CP.

"... are you discretizing the boundary ,and then at each point ..."

Yes, that is pretty much exactly what I and the paper is doing but there is a huge amount of detail to be considered that is too long for this answer. (But "... noting the nearest point of the other end ...") is a bit vaguely stated of course.)

sir what you are saying is for each iteration of the center depends on the boundary step length in the bezier curve(i.e distance between successive points in the curve )
doubt2) in order to check if the inward normal line intersects the another bezier curve or not , if it is implicit function (like x^2 +y^2=radius^2 --->is circle equation where i can solve by substituting the line equation y=mx+c m-inward normal slope of the point in the boundary ) but how can i check for if the the inward normal intersects the curve or not sir?

Ω- group of all connected bezier segments
∂Ω- one segment of it (right sir?)

"... each iteration of the center depends on the boundary step length ..."

No, each iteration is to get a more accurate circle center point for a single specific boundary point.

"... how can i check for if the the inward normal intersects the curve or not ..."

Sorry hariharan382 but I cannot possibly answer all these types of general questions. Best
for you to ask on Stack Overflow or Google it.

"... Ω- group of all connected bezier segments
∂Ω- one segment of it (right sir?) ..."

No!!! Read my answer and the paper again carefully: Ω: the "colored-in shape" (don't worry about this!), ∂Ω: set of all connected bezier segments.

"... there exist infinite amount of point with respect to parameter t ..."

Correct, but only a subset are calculated based on criteria such as the
curvature. The higher the curvature the more points are calculated. However,
any desired point can be chosen and the corresponding MA point can be calculated
for it.

"... How are you indexing the bezier curve pieces ..."

They are stored as a simple array with the last curve implicitly pointing back
to the first. In the code it is also sometimes stored as a simple linked list
with the last curve pointing back to the first to form a loop.

"... how do I know whether the circle intersect any point in all other analytic curve pieces ..."

Try following the code. The procedure is:

Find the power basis form of the (let's assume cubic) bezier curve. This gives us two parametric functions in $t$, one for the $x$ coordinate and one for the $y$ coordinate. (see this document.)

The formula for a circle is $x^2 + y^2 = r^2$. Substitute the $x$ and $y$ found above into this equation to get a univariate polynomial in $t$. Numerically solve the roots for $t$ (not easy without the help of a library function). Substitute the roots into $x$ and $y$ and you'll have your point of intersection between a circle and bezier curve.

Check the circle with each curve in turn (i.e loop through all curves) and find all intersections.

I strongly suggest you only find some medial axis points and move from point to point by getting the closest point from each point. Do not try and calculate the actual medial axis curves - it is not easy!

I'm not sure I understand you correctly. Why do you want to store the points - they are all represented by the bezier curve (which in turn is represented by its control points). Just calculate it when you need it.

If you mean you need to know which parameter values to use (e.g. 0.01, 0.02, ..., 1) then use more points where the curvature is higher since this will give more accurate results, see e.g. this (from where you can go directly to the source code too)

If this does not answer your question then try and state your question more clearly please.

Yes, a path can have multiple loops so look for an 'M' or 'm' which indicates the start of a new path. Everything is explained here. An 'M' or 'm' starts a path and a 'Z' or 'z' ends a path. Why don't you first focus on paths with just a single loop? I cannot stress this enough -> START SIMPLE!

You're very welcome to give me a WhatsApp call but I don't want to publish my number here so not sure how to set that up? My time zone is GMT-7 and I'm usually available between 9:00 and 15:00.

Sorry, your email address was censored. The only way I would be able to see it I think is if you make your email address public in Github settings.

sir, I almost finished my algorithm, the only thing blocking me is the Domain decomposition lemma, in a paper in order to find n prong they are using it, but in stack overflow, you were pointing to find the first 2 prongs and then moving on to 3 prongs by next. next reversal scheme,
My question is :
when traversing the on cp, how do I know there exists 3 prongs or 4 prongs? please answer this...