Mesh is a 3D object constructed from polygons (named faces) that share edges. Matlab contains functions for plotting 3d objects, specifically meshes.
This project won the Distiguished Project Award of VISL 2005
Mesh is a 3D object constructed from polygons (named faces) that share edges. Matlab contains functions for plotting 3d objects, specifically meshes. Matlab does not contain mesh manipulation tools which are crucial for the computer graphics and computational geometry community. The goal of this project is to create a set of tools (functions and toolbars) to add to Matlab mesh manipulations capabilities.
We use Matlab to represent a mesh in the following way:
Structure containing the fields:
i. type: ‘mesh’
ii. vertices: Nx3 matrix (x,y,z in columns)
iii. tri: Mx3 matrix (indices of vertices in vertices list)
for segnmented meshes, the structure have additonal field:
iv. labels: Mx1 matrix.
Skeleton is associated with a mesh and used to manipulate the mesh easily. Skeleton is basically Directed tree: The vertices are named Joints, and The edges are named Bones. Each bone E=(u,v) is associated with its start joint u.
Each joint has its own local coordinate system, such that The bone assigned with the joint is on X axis of the local coordinate system. The root’s local coordinate system is the global system (of the figure).
|offread||read off file and return mesh structure|
|vecRotTans||given two vectors, return the rotation matrix from vec1 to vec2|
|meshPlot||plots mesh in current figure|
|skelPlot||plot a skeleton in current figure|
|skelPlotBone||plot single bone (as cone) from boneBase to boneEnd|
|skelShowAxes||plot local coordinate system of given joint is skel|
|offChooseVertices||returns all vertices belong to same segment in given mesh|
|offGinput||interactivlly select data from mesh with mouse|
|skelFromSegments||creates skeleton and tree based on segmented mesh|
|skelToolBar||interactively create and edit skeletons, trees and skinMappings|
|Mesh and skeleton deformation|
|meshApplySkelDeform||apply deformation on mesh according to given skeleton|
|meshApplyJointDeform||apply the transformation represented by rotAxis and rotAngle on given joint in skel|
|skelGetRotation||get the rotation parameters of given joint in skel|
|skelSetRotation||set the rotation parameters of given joint in skel|
|skelMatchSkeletons||match the configuration of two skeletons with the same structure|
|skelRotateJoint||apply rotation of a given joint in skeleton|
|skelInterpolate||interpolate skel position between to given skeleton positions|
|axisAngle2rotMat||given rotation presented by axis and angle, returns the rotation matrix that represents the same rotation|
|rotMat2axisAngle||given rotation matrix, returns the same rotation represented as axis-angle form|
|tree2skel||converts tree data structure to skeleton data structure|
|skel2tree||converts skeleton data structure to tree|
|skelToolbar||Intuitive tool to create skeletons manually. Define joints, bones, parent-child relations, and
skin mapping. Enable deformation of the mesh directly from the figure.
|animToolbar||Skeleton manipulation for animation. Change the skeleton configuration at specific frames (Key Frames) and
interpolate the transition between frames.
%build skeleton to the mesh and plot it:
%show local coord. systems of some joints:
%apply rotation to some joints:
skel1=skelRotateJoint(origskel,13,[0 1 0], -rad(80));
skel1b=skelRotateJoint(skel1,8,skelConvertAxis(skel1,[0 1 0],8,3), rad(50));
%match the mesh to the new skeleton:
More examples can be found in the project documentation.
Many thanks go to our project supervisor Sagi Katz and to the Ollendorff Minerva Center which supported this project.