Offset a solid object by a specified distance

I’m really in a standstill that I don’t know how to offset a solid by a specified distance like this picture below.

http://www.smlib.com/Manual/DocImages/smlib_offsetting.jpg

Would you mind giving to me a sample similiar to this case (such as offsetting a 3D solid square)

please, help me :frowning:

Not a simple problem.

You might be able to do something with vertex shaders.

Looks like they moved the vertex along the normal… Something like that

world_vertex = world_vertex+radius*world_normal

Still, there appears to be some smoothing involved…

Move each vertex along its normal.
The problem is remaining intersecting geometry.

To get the round corners the mesh needs to be finely tessellated.

I don’t think this can easily be done using vertex-shaders. Maybe, together with geometry-shaders, but that’s just a guess.

In my opinion you need a much more sophisticated algorithm (done on the CPU) to achieve the result.
Jan.

It uses to generate the toolpath for simulation.

from http://www.smlib.com/Manual/SMLibFunct.html, it says that:

the implementation of the Solid Offsetting Algorithm is relatively simple given the powerful tools available within SMLib. Offsetting utilizes facilities from the SMLib Merge and SMLib Filleting to do most of the difficult work. This unique approach also keeps special case handling to a minimum. The entire algorithm was implemented with two new classes (IwOffsetExecutive and IwOffsetGeometryCreation) and less than 20 new methods of moderate size. The basic approach is as follows:

  1.   Generate faces representing the offsets of existing faces of a solid.
    
  2.   Insert self-intersection edges of offset faces.
    
  3.   Generate faces representing the offsets of edges of the solid.  This utilizes filleting tools to generate circular blends between corresponding edges of offset faces.  In cases where the offset faces have self-intersections, a single edge may require several blends and corner patches. 
    
  4.   Generate offset faces for vertices.  We use a triangular trimmed piece of a sphere for simple cases and a complete sphere for some more difficult cases.
    
  5.   Utilize the “Partial Merge” to put all of the offset faces together.  Note that we utilize existing topological relationships eliminate unnecessary surface/surface intersections and speed up the process several orders of magnitude over a straight “Merge”.
    
  6.   After the “Partial Merge” we need to identify which regions (i.e. volumes) to keep.  In most cases this is just the shell bounding the outer region.  However, it is possible to create void regions within a solid.
    
  7.   Call “Make Manifold” with the selected regions to remove all topology elements not bounding the given regions.
    

This algorithm lends itself to the creation of very large offsets where the offsets of features of the solid intersect each other. This type of offset is ideal for various NC operations. Right now the algorithm works quite well with analytical parts that don’t have freeform fillets, blends, and corner patches. The proper handling of these things requires identification and special handling. The best way to do it is to regenerate the fillets, blends, and corner patches directly from the offset surfaces instead of trying to offset the surface directly. There are also some problems with self-intersecting surfaces that are basically impossible to solve in a reasonable way. For solids with these type of surfaces, it is only possible to create offsets of relatively small radius.

Because I’m new to OpenGL, so I don’t know how to do it :(( .