|
 |
"Chris R" <car### [at] comcast net> wrote:
> "Bald Eagle" <cre### [at] netscape net> wrote:
> > "Chris R" <car### [at] comcast net> wrote:
> >
> > > Just thought it might be of interest.
> >
> > Yes it is! :)
> > I've thought about, and looked into doing some "mathematical origami" here and
> > there. Never got around to writing any code for it though.
> >
> > > The code is still a bit messy and not
> > > well commented, so I won't point you to the GitHub repo for it yet.
> >
> > Still - great job!
> >
> > I tried to "crush" a vertical edge of a box at one point, and would assume the
> > same sort of math and algorithms would apply. Do you think anything in your
> > library would be applicable to that?
> >
> > - BE
>
> The java library consists of code for managing a grid of points in a 2D plane
> that automatically generates triangles. There are other routines that then let
> you subdivide the triangles for regions where you expect to be doing
> transformations to make them smoother.
>
> Once all of the subdivisions are done, there is code for creating 3D vertices
> and triangular faces from the 2D plane. You can then search for vertices that
> meet certain criteria, find all of the faces that are connected to that vertex,
> and vice-versa; look for all faces that meet a certain criteria and get the
> vertices for those faces.
>
> Once you have that, you can do whatever you want to the vertices. There is
> still code in there to do further subdivisions of the faces if it's easier to do
> it on the 3D points rather than the original 2D points. You can adjust the
> normals of the vertices and set UV coordinates.
>
> For the paper wrapping application, I created a transformation that imitates
> what would happen if you folded a piece of paper at any angle around a cylinder
> with a fixed radius: if the point is within the arc-length of the angle around
> the cylinder, the point maps to the relevant point on the cylinder, otherwise,
> subtract off that arc-length from the distance of the point to the cylinder,
> then rotate the subtracted point around the cylinder at the given angle, and
> translate it to the point on the cylinder at that angle. The code allows for
> cylinders with non-fixed radii as well, but I haven't tested that with the box
> folding yet.
>
> Once you are done, there is code to generate the mesh2 object in a .inc file.
> The library code supports both smooth and flat triangles in the mesh, although
> the specific app I wrote to create the wrapping paper uses all smooth triangles.
>
> So, the short answer is, yes, you could pretty easily perturb the vertices of
> your box object after it has been folded in a region that you want to crush.
> You just need to define that region, make sure it has small enough triangles to
> make your crushing pattern realistic, and then apply that pattern to all of the
> vertices in the region.
>
> I'm going to do a simple one with the wrapping paper application to make sure
> that all works.
>
> -- Chris R
Just a test, pushing in one side of the box in a circular area and then folding
it up...
Post a reply to this message
Attachments:
Download 'gifts.png' (240 KB)
Preview of image 'gifts.png'

|
 |