{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "1abdefe3",
   "metadata": {},
   "source": [
    "# del-msh\n",
    "\n",
    "Python static 3D mesh utility library for prototyping in computer graphics research.\n",
    "\n",
    "\n",
    "## Install \n",
    "\n",
    "```shell\n",
    "pip install del-msh\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "28f4c8ba",
   "metadata": {},
   "source": [
    "## Generate Primitive Mesh"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "96f0b116",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "V is vertex coordinates: type <class 'numpy.ndarray'> , dtype: < float32 >, shape: (994, 3)\n",
      "<class 'numpy.ndarray'> (1984, 3)\n"
     ]
    }
   ],
   "source": [
    "import del_msh\n",
    "\n",
    "# generate primitive mesh\n",
    "V,F = del_msh.torus_meshtri3(0.6, 0.3, 32, 32) # torus\n",
    "V,F = del_msh.capsule_meshtri3(0.1, 0.6, 32, 32, 32) # capsule\n",
    "V,F = del_msh.cylinder_closed_end_meshtri3(0.1, 0.8, 32, 32) # cylinder\n",
    "V,F = del_msh.sphere_meshtri3(1., 32, 32) # sphere\n",
    "print(\"V is vertex coordinates: type\",type(V),\", dtype: <\",V.dtype,\">, shape:\",V.shape)\n",
    "print(type(F),F.shape)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1f333be2",
   "metadata": {},
   "source": [
    "---\n",
    "## Importing Wavefront Obj file"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "2f604807",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "vtx_xyz <class 'numpy.ndarray'> (2738, 3)\n",
      "elem_vtx_index <class 'numpy.ndarray'> (2777,)\n",
      "elem_vtx_xyz <class 'numpy.ndarray'> (10996,)\n"
     ]
    }
   ],
   "source": [
    "from pathlib import Path\n",
    "newpath = Path('.') / 'asset' / 'HorseSwap.obj'\n",
    "\n",
    "vtx_xyz, elem_vtx_index, elem_vtx_xyz = del_msh.load_wavefront_obj(str(newpath))    \n",
    "print(\"vtx_xyz\",type(vtx_xyz),vtx_xyz.shape)\n",
    "print(\"elem_vtx_index\",type(elem_vtx_index),elem_vtx_index.shape)\n",
    "print(\"elem_vtx_xyz\",type(elem_vtx_xyz),elem_vtx_xyz.shape)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
