| Author |
Comment/Response |
toen
|
01/25/12 8:43pm
Hi Sid,
I'm not aware of any built-in package to use. If you do find any built-in functionality, please repost to let me know.
There are a few ways you can go:
1. You can generate a picture, and extract the mesh data from the GraphicsComplex. Then do mesh-based calculations for the curvatures. Use the link between Div and the Gaussian curvature (I've forgotten how to calculate mean curvature, google will tell you).
There are all kinds of subtle (and not-so-subtle) problems with this approach, if you're after precise data.
2. Alternatively do the calculations on the interpolating functions themselves, and evaluate at the mesh points. This way worked better for me. Use some equations from papers by "Alan L. Mackay" from the 80's and 90's (or others) for this. Some code for the Gaussian curvature is attached below.
Once you've got your curvatures, you can map them onto the surface by inserting a VertexColors -> (list of colour commands for each vertex) into the GraphicsComplex.
Note that if your surface is periodic, you can use the space group information to create a really good interpolation. Use the trigonometric expansions from a crystallography reference book.
To give you an idea of the usefulness I've attached an image created in this way.
cheers,
toen
>>>
GaussCurv[f_,{x_,y_,z_}]:=Module[{Id},Det[Table[j[i[f]]/.Id[Id[_]]->0/.Id->Identity,{i,{\!\(
\*SubscriptBox[\(\[PartialD]\), \(x\)]#\)&,\!\(
\*SubscriptBox[\(\[PartialD]\), \(y\)]#\)&,\!\(
\*SubscriptBox[\(\[PartialD]\), \(z\)]#\)&,Id}},{j,{\!\(
\*SubscriptBox[\(\[PartialD]\), \(x\)]#\)&,\!\(
\*SubscriptBox[\(\[PartialD]\), \(y\)]#\)&,\!\(
\*SubscriptBox[\(\[PartialD]\), \(z\)]#\)&,Id}}]]/(((\!\(
\*SubscriptBox[\(\[PartialD]\), \(x\)]f\))^2+(\!\(
\*SubscriptBox[\(\[PartialD]\), \(y\)]f\))^2+(\!\(
\*SubscriptBox[\(\[PartialD]\), \(z\)]f\))^2+10^-9)^2)];
Attachment: Screen shot 2012-01-26 at 1.40.03 PM.png, URL: , |
|