Covering any surface with helix-shaped curves - geometry

I have a question about the feasability of an idea.
I have a surface (which can be parametrized or defined implicitly by an equation F(x,y,z) = 0) and I want to draw some helix that fit the surface, litterally helix on the surface.
What would be the process to achieve that ?
I have a basic idea ,which is inspired from ray marching methods, : I have my surface (which have a finite area) then I 'draw' a big helix curve around it and I decrease the radius of the helix. If the helix intersect the surface then I save that point, and finally I would obtain the set of points that draw an helix on the surface...
Feel free to ask me questions about the problem.
Thank you for your attention.
thomas

There are different ways to understand "drawing a helix curve" on a surface. By the way, I am not sure that you use the proper term, as a helix is a spring-like curve and is not flat at all. I will instead assume some planar curve described by an implicit C(x,y)=0 or parametric x=Xc(t),y=Yc(t) representation.
One approach is by using a (u,v) parameterization of the surface, as used in texture mapping, x=Xs(u,v), y=Ys(u, v), z=Zs(u, v). For example, for a sphere (u,v) could correspond to the angle coordinates in the spherical system. In this case, it suffices to map x=u, y=v and there will be a direct correspondence between the points of the curve and the points of the surface.
Another approach is by "extruding" the curve in the z direction to form a cylindric surface, and intersect the cylindre with the surface. In this case, you form the system
S(x, y, z)= 0
C(x, y)= 0
where z is free, and solve for (x, y) as a function of z. (You can also use the parametric equations, there are different combinations.) In fact, you perform a parallel projection of the curve.
Instead of a cylindre, you can also think of a conic surface, by choosing a vertex point, say the origin, and considering the points (zx, zy, az) where a is an "aperture" coefficient and z is free. This idea is vey close to your "radius decrease" method and corresponds to a central projection.

Related

Is it possible to test whether a given mesh is a hollow cylinder(like a pipe) or not?

I don't know much about geometric algorithms, but I just wanted to know if given a mesh, is there an algorithm that outputs a boolean which is true when the mesh is actually a hollow cylinder (like a straight pipe) or else, it will be false. Any reference to the algorithm if it exists would be helpful.
EDIT: I am relatively sure that the body has a surface mesh, basically the only the surfaces of the object is meshed and it uses triangles for meshing.
A key problem is to find the axis of the cylindre. If it is known, you are done. If it is unknown but the cylindre is known to be without holes and delimited by two perpendicular bases, the main axis of inertia can be used. Otherwise, it should be constructible from the coordinates of five points (A Cylinder of Revolution on Five Points http://www.cim.mcgill.ca/~paul/12ICGG6Aw.pdf).
When you know the axis, it suffices to check that the distance of every point to the axis is constant. In case the mesh describes a solid (i.e. a surface with thickness), make sure to pick the points on the outer surface, for example using the orientation of the normals. There will be two distances and the lateral faces must be ignored.

Calculate equidistant point with minimal distance from 3 points in N-dimensional space

I'm trying to code the Ritter's bounding sphere algorithm in arbitrary dimensions, and I'm stuck on the part of creating a sphere which would have 3 given points on it's edge, or in other words, a sphere which would be defined by 3 points in N-dimensional space.
That sphere's center would be the minimal-distance equidistant point from the (defining) 3 points.
I know how to solve it in 2-D (circumcenter of a triangle defined by 3 points), and I've seen some vector calculations for 3D, but I don't know what the best method would be for N-D, and if it's even possible.
(I'd also appreciate any other advice about the smallest bounding sphere calculations in ND, in case I'm going in the wrong direction.)
so if I get it right:
Wanted point p is intersection between 3 hyper-spheres of the same radius r where the centers of hyper-spheres are your points p0,p1,p2 and radius r is minimum of all possible solutions. In n-D is arbitrary point defined as (x1,x2,x3,...xn)
so solve following equations:
|p-p0|=r
|p-p1|=r
|p-p2|=r
where p,r are unknowns and p0,p1,p2 are knowns. This lead to 3*n equations and n+1 unknowns. So get all the nonzero r solutions and select the minimal. To compute correctly chose some non trivial equation (0=r) from each sphere to form system of n+1 =equations and n+1 unknowns and solve it.
[notes]
To ease up the processing you can have your equations in this form:
(p.xi-p0.xi)^2=r^2
and use sqrt(r^2) only after solution is found (ignoring negative radius).
there is also another simpler approach possible:
You can compute the plane in which the points p0,p1,p2 lies so just find u,v coordinates of these points inside this plane. Then solve your problem in 2D on (u,v) coordinates and after that convert found solution form (u,v) back to your n-D space.
n=(p1-p0)x(p2-p0); // x is cross product
u=(p1-p0); u/=|u|;
v=u x n; v/=|v|; // x is cross product
if memory of mine serves me well then conversion n-D -> u,v is done like this:
P0=(0,0);
P1=(|p1-p0|,0);
P2=(dot(p2-p0,u),dot(p2-p0,v));
where P0,P1,P2 are 2D points in (u,v) coordinate system of the plane corresponding to points p0,p1,p2 in n-D space.
conversion back is done like this:
p=(P.u*u)+(P.v*v);
My Bounding Sphere algorithm only calculates a near-optimal sphere, in 3 dimensions.
Fischer has an exact, minimal bounding hyper-sphere (N dimensions.) See his paper: http://people.inf.ethz.ch/gaertner/texts/own_work/seb.pdf.
His (C++/Java)code: https://github.com/hbf/miniball.
Jack Ritter
jack#houseofwords.com

Creating a surface from a path of 3D cubic bezier curves

I have a list of cubic bezier curves in 3D, such that the curves are connected to each other and closes a cycle.
I am looking for a way to create a surface from the bezier curves. Eventually i want to triangulate the surface and present it in a graphic application.
Is there an algorithm for surfacing a closed path of cubic bezier segments?
It looks like you only know part of the details of the surface (given by the Bezier curves) and you've to extrapolate the surface out of it. As a simple example I'm imagining a bunch of circles in 3D with the center and radius that will be reconstructed into a sphere.
If this is the case you can use level sets. With level sets, you define a bunch of input parameters that defines the force exerted by the external factors on your surface and the 'tension' of the surface.
Crudely put, level sets define the behaviour of surface as they expand(or contract ) over time. As it expands it tries to maintain it's smoothness while meeting other boundary conditions - like 'sticking' to the circles in this case. So if you want a sphere from bunch of circles, the circles will exert a great force, while the surface will also be very tense.
Physbam has an open source implementation of level sets.
CGAL and PCL also provide a host of methods that generate surfaces from things such as points sets and implicit surface. You may be able to adapt one of them for your use.
You can look into the algorithms they use if you want to implement one on your own. I think at least one of them use the Poisson Surface Reconstruction algorithm.

Sphere and nonuniform object intersection

I have two objects: A sphere and an object. Its an object that I created using surface reconstruction - so we do not know the equation of the object. I want to know the intersecting points on the sphere when the object and the sphere intersect. If we had a sphere and a cylinder, we could solve for the equation and figure out the area and all that but the problem here is that the object is not uniform.
Is there a way to find out the intersecting points or area on the sphere?
I'd start by finding the intersection of triangles with the sphere. First find the intersection of each triangle's plane and the sphere, which gives a circle. Then find the circle's intersection/s with the triangle edges in 2D using line/circle tests. The result will be many arcs which I guess you could approximate with lines. I'm not really sure where to go from here without knowing the end goal.
If it's surface area you're after, maybe a numerical approach would be better. I'd cover the sphere in points and count the number inside the non-uniform object. To find if a point is inside, maybe trace outwards and count the intersections with the surface (if it's odd, the point is inside). You could use the stencil buffer for this if you wanted (similar to stencil shadows).
If you want the volume of intersection a quick google search gives "carve", a mesh based CSG library.
Starting with triangles versus the sphere will give you the points of intersection.
You can take the arcs of intersection with each surface and combine them to make fences around the sphere. Ideally your reconstructed object will be in winged-edge format so you could just step from one fence segment to the next, but with reconstructed surfaces I guess you might need to apply some slightly fuzzy logic.
You can determine which side of each fence is inside the reconstructed object and which side is out by factoring in the surface normals along the fence.
You can then cut the sphere along the fences and add the internal bits to the display.
For the other side of things you could remove any triangle completely inside the sphere and cut those that intersect.

How to optimally plot parametric continuous curve?

Let's say we have a parametric curve, for example a circle:
x = r * cos(t)
y = r * sin(t)
We want to plot the curve on the screen in a way that:
every pixel is painted just once (the optimal part)
there is a painted pixel for each (x, y) that lies on the curve (the continuous part)
If we just plot (x, y) for each t in [t1, t2], these conditions will not be met.
I am searching for a general solution for any parametric curve.
A general solution that 100% satisfies your criteria does not exist.
So we have to compromize.
Usually this is tackled by starting with a stepsize (usually a parameter to your routine), this stepsize can be subdivided triggered by a heuristic e.g.:
subdivide when the distance covered by a segment is larger than a given distance (e.g. one pixel)
subdivide when the curve direction changes too much
Or a combination of these.
Usually some limit to subdivision is also given to avoid taking forever.
Many systems that offer parametric plotting start with some changeable default setting for the heuristic params and step size. The user can adapt these if the curve is not "nice" enough or if it takes too long.
The problem is that there are always pathological curves that will defeat your method of drawing making it miss details or taking overly long.
Check out Bézier splines.

Resources