Disabled external gits
This commit is contained in:
		@@ -0,0 +1,482 @@
 | 
			
		||||
{
 | 
			
		||||
 "cells": [
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "code",
 | 
			
		||||
   "execution_count": 3,
 | 
			
		||||
   "id": "47a1752b-1db4-4004-9991-164388c0fd5d",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "import numpy as np\n",
 | 
			
		||||
    "import meshplot as mp"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "code",
 | 
			
		||||
   "execution_count": 4,
 | 
			
		||||
   "id": "0f4900fe-ce65-410a-b8d3-088e7e0804a5",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "import igl\n",
 | 
			
		||||
    "import scipy as sp\n",
 | 
			
		||||
    "import numpy as np\n",
 | 
			
		||||
    "from meshplot import plot, subplot, interact\n",
 | 
			
		||||
    "import time\n",
 | 
			
		||||
    "import copy\n",
 | 
			
		||||
    "import matplotlib.pyplot as plt"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "code",
 | 
			
		||||
   "execution_count": 5,
 | 
			
		||||
   "id": "9c83b851-d0aa-4fb0-9030-a285ca6b2b64",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "import sys\n",
 | 
			
		||||
    "sys.path.append('../src')"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "code",
 | 
			
		||||
   "execution_count": 6,
 | 
			
		||||
   "id": "43cb9cef-4959-4c9b-98ef-3a603f57bcb2",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "import importlib, utils, laplacian_utils, mean_curvature_flow, remesher_helper\n",
 | 
			
		||||
    "importlib.reload(utils)\n",
 | 
			
		||||
    "importlib.reload(laplacian_utils)\n",
 | 
			
		||||
    "importlib.reload(mean_curvature_flow)\n",
 | 
			
		||||
    "importlib.reload(remesher_helper)\n",
 | 
			
		||||
    "from utils import parse_input_mesh, normalize_area, get_diverging_colors, remesh\n",
 | 
			
		||||
    "from mean_curvature_flow import MCF"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "code",
 | 
			
		||||
   "execution_count": 7,
 | 
			
		||||
   "id": "2570faf5-9582-42ac-ace4-ca82c781a806",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "epsilon1 = 5e-2\n",
 | 
			
		||||
    "epsilon2 = 1e-3\n",
 | 
			
		||||
    "mesh_color = np.array([0,0.7,1])"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "markdown",
 | 
			
		||||
   "id": "e8d2f669-864f-4c8e-8519-5672862cc024",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "source": [
 | 
			
		||||
    "### Example 1"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "code",
 | 
			
		||||
   "execution_count": 6,
 | 
			
		||||
   "id": "7a65d5c7-d774-4d5a-946c-69d730f19519",
 | 
			
		||||
   "metadata": {
 | 
			
		||||
    "tags": []
 | 
			
		||||
   },
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "v1, f1, num_bdry_vx, num_intr_vx = parse_input_mesh(\"../data/two_rings_remesh.obj\")\n",
 | 
			
		||||
    "curr_mcf = MCF(num_bdry_vx, num_intr_vx)"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "code",
 | 
			
		||||
   "execution_count": 7,
 | 
			
		||||
   "id": "a82f1487-56e3-4ecb-b71c-b3f59d4070be",
 | 
			
		||||
   "metadata": {
 | 
			
		||||
    "tags": []
 | 
			
		||||
   },
 | 
			
		||||
   "outputs": [
 | 
			
		||||
    {
 | 
			
		||||
     "ename": "TypeError",
 | 
			
		||||
     "evalue": "unsupported operand type(s) for /: 'NoneType' and 'NoneType'",
 | 
			
		||||
     "output_type": "error",
 | 
			
		||||
     "traceback": [
 | 
			
		||||
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
 | 
			
		||||
      "\u001b[0;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
 | 
			
		||||
      "\u001b[0;32m/tmp/ipykernel_12039/3840203228.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[0mstart\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtime\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtime\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mvs1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0maverage_mean_curvature_list1\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcurr_mcf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun_mean_curvature_flow\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mv1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mf1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m1000\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m5e-2\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m1e-3\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m      3\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Run {} iterations of unstable mean curvature flow\"\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0maverage_mean_curvature_list1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      4\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"took {} seconds\"\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtime\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtime\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m-\u001b[0m \u001b[0mstart\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
 | 
			
		||||
      "\u001b[0;32m/opt/notebooks/assignment_3_2/notebook/../src/mean_curvature_flow.py\u001b[0m in \u001b[0;36mrun_mean_curvature_flow\u001b[0;34m(self, v, f, max_iter, epsilon1, epsilon2)\u001b[0m\n\u001b[1;32m     83\u001b[0m             \u001b[0mYour\u001b[0m \u001b[0mcode\u001b[0m \u001b[0mhere\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     84\u001b[0m             '''\n\u001b[0;32m---> 85\u001b[0;31m             \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msolve_laplace_equation\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mv\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     86\u001b[0m             \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mupdate_system\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mv\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     87\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
 | 
			
		||||
      "\u001b[0;32m/opt/notebooks/assignment_3_2/notebook/../src/mean_curvature_flow.py\u001b[0m in \u001b[0;36msolve_laplace_equation\u001b[0;34m(self, v, f)\u001b[0m\n\u001b[1;32m     44\u001b[0m         '''\n\u001b[1;32m     45\u001b[0m         \u001b[0;31m# Construct the LHS and RHS of the linear solve.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 46\u001b[0;31m         \u001b[0mlhs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mL\u001b[0m\u001b[0;34m/\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mM\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mnum_bdry_vx\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     47\u001b[0m         \u001b[0mrhs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mzeros\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mnum_intr_vx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     48\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
 | 
			
		||||
      "\u001b[0;31mTypeError\u001b[0m: unsupported operand type(s) for /: 'NoneType' and 'NoneType'"
 | 
			
		||||
     ]
 | 
			
		||||
    }
 | 
			
		||||
   ],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "start = time.time()\n",
 | 
			
		||||
    "vs1, average_mean_curvature_list1 = curr_mcf.run_mean_curvature_flow(v1, f1, 1000, 5e-2, 1e-3)\n",
 | 
			
		||||
    "print(\"Run {} iterations of unstable mean curvature flow\".format(len(average_mean_curvature_list1)))\n",
 | 
			
		||||
    "print(\"took {} seconds\".format(time.time() - start))"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "code",
 | 
			
		||||
   "execution_count": null,
 | 
			
		||||
   "id": "652d1fa7-ad74-4c50-85c1-6a9e622b7ec8",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "plt.plot(average_mean_curvature_list1)"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "code",
 | 
			
		||||
   "execution_count": null,
 | 
			
		||||
   "id": "14411752-e879-40f4-a3ce-928cfa2e888e",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "p1 = mp.plot(vs1[0], f1, shading={\"wireframe\": False,\"width\": 900, \"height\": 600}, return_plot=True, c=mesh_color)\n",
 | 
			
		||||
    "\n",
 | 
			
		||||
    "@interact(level=(0, len(vs1)-1))\n",
 | 
			
		||||
    "def mcf(level=0):\n",
 | 
			
		||||
    "    p1.update_object(vertices=vs1[level])"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "markdown",
 | 
			
		||||
   "id": "baf4bc95-68df-4a4b-967f-a2b555d4947c",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "source": [
 | 
			
		||||
    "### Example 2"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "code",
 | 
			
		||||
   "execution_count": null,
 | 
			
		||||
   "id": "147b044e-4491-4e45-bf91-df58f870429f",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "v2, f2, num_bdry_vx, num_intr_vx = parse_input_mesh(\"../data/half_cube_remesh.obj\")\n",
 | 
			
		||||
    "curr_mcf = MCF(num_bdry_vx, num_intr_vx)"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "code",
 | 
			
		||||
   "execution_count": null,
 | 
			
		||||
   "id": "dbc8d3df-ac70-4c75-a6e7-d624595d5a59",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "start = time.time()\n",
 | 
			
		||||
    "vs2, average_mean_curvature_list2 = curr_mcf.run_mean_curvature_flow(v2, f2, 1000, epsilon1, epsilon2)\n",
 | 
			
		||||
    "print(\"Run {} iterations of unstable mean curvature flow\".format(len(average_mean_curvature_list2)))\n",
 | 
			
		||||
    "print(\"took {} seconds\".format(time.time() - start))"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "code",
 | 
			
		||||
   "execution_count": null,
 | 
			
		||||
   "id": "87c6c46b-36e4-4206-96da-b3f10d897387",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "plt.plot(average_mean_curvature_list2)"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "code",
 | 
			
		||||
   "execution_count": null,
 | 
			
		||||
   "id": "db07878e-9438-413d-9eb5-a2ffb8f02118",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "p2 = mp.plot(vs2[0], f2, shading={\"wireframe\": False, \"flat\": True}, c=mesh_color)\n",
 | 
			
		||||
    "\n",
 | 
			
		||||
    "@interact(level=(0, len(vs2)-2))\n",
 | 
			
		||||
    "def mcf(level=0):\n",
 | 
			
		||||
    "    p2.update_object(vertices=vs2[level])"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "markdown",
 | 
			
		||||
   "id": "613b0257-40c3-4f8f-8840-ea9dccccefa9",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "source": [
 | 
			
		||||
    "### Example 3"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "code",
 | 
			
		||||
   "execution_count": null,
 | 
			
		||||
   "id": "ddd60020-bc75-4984-937f-ab30359b559c",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "v3, f3, num_bdry_vx, num_intr_vx = parse_input_mesh(\"../data/cube_remesh.obj\")\n",
 | 
			
		||||
    "curr_mcf = MCF(num_bdry_vx, num_intr_vx)"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "code",
 | 
			
		||||
   "execution_count": null,
 | 
			
		||||
   "id": "661c1cfb-3ac6-434a-b385-a94be86f2802",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "start = time.time()\n",
 | 
			
		||||
    "vs3, average_mean_curvature_list3 = curr_mcf.run_mean_curvature_flow(v3, f3, 1000, epsilon1, epsilon2)\n",
 | 
			
		||||
    "print(\"Run {} iterations of unstable mean curvature flow\".format(len(average_mean_curvature_list3)))\n",
 | 
			
		||||
    "print(\"took {} seconds\".format(time.time() - start))"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "code",
 | 
			
		||||
   "execution_count": null,
 | 
			
		||||
   "id": "06d71f4a-214a-4fbc-84ee-aad174ac104f",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "plt.plot(average_mean_curvature_list3)"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "code",
 | 
			
		||||
   "execution_count": null,
 | 
			
		||||
   "id": "4e3faeb6-3f38-43d1-a4a0-047b62e11bf3",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "p3 = mp.plot(vs3[0], f3, shading={\"wireframe\": False, \"flat\": True}, c=mesh_color)\n",
 | 
			
		||||
    "\n",
 | 
			
		||||
    "@interact(level=(0, len(vs3)-2))\n",
 | 
			
		||||
    "def mcf(level=0):\n",
 | 
			
		||||
    "    p3.update_object(vertices=vs3[level])"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "markdown",
 | 
			
		||||
   "id": "d92f7eea-e7f0-4a92-b557-21637eb7f939",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "source": [
 | 
			
		||||
    "## Your Own Minimal Surface!"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "markdown",
 | 
			
		||||
   "id": "242feed4-775d-4c68-aadb-707382dde2f5",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "source": [
 | 
			
		||||
    "### Visualize your blender output\n"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "code",
 | 
			
		||||
   "execution_count": 8,
 | 
			
		||||
   "id": "105532b3-69ab-4835-9768-5a03df5051af",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "blender_input_filename = \"../data/mesh.obj\""
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "code",
 | 
			
		||||
   "execution_count": 9,
 | 
			
		||||
   "id": "c9e2c901-d3f9-4a2f-bb3b-27a8be7b2311",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "outputs": [
 | 
			
		||||
    {
 | 
			
		||||
     "name": "stderr",
 | 
			
		||||
     "output_type": "stream",
 | 
			
		||||
     "text": [
 | 
			
		||||
      "Warning: readOBJ() ignored non-comment line 3:\n",
 | 
			
		||||
      "  o BezierCircle.002_Mesh.002\n"
 | 
			
		||||
     ]
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
     "data": {
 | 
			
		||||
      "application/vnd.jupyter.widget-view+json": {
 | 
			
		||||
       "model_id": "c3305f3372914f049d1f00b95e75db4c",
 | 
			
		||||
       "version_major": 2,
 | 
			
		||||
       "version_minor": 0
 | 
			
		||||
      },
 | 
			
		||||
      "text/plain": [
 | 
			
		||||
       "Renderer(camera=PerspectiveCamera(aspect=1.5, children=(DirectionalLight(color='white', intensity=0.6, positio…"
 | 
			
		||||
      ]
 | 
			
		||||
     },
 | 
			
		||||
     "metadata": {},
 | 
			
		||||
     "output_type": "display_data"
 | 
			
		||||
    }
 | 
			
		||||
   ],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "v,f = igl.read_triangle_mesh(blender_input_filename)\n",
 | 
			
		||||
    "p1 = plot(v, f, shading={\"wireframe\": True,\"width\": 900, \"height\": 600}, return_plot=True, c=mesh_color)"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "markdown",
 | 
			
		||||
   "id": "264e0ee7-8a7d-44b0-8221-fc15b38ce77e",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "source": [
 | 
			
		||||
    "### Remesh"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "markdown",
 | 
			
		||||
   "id": "b6905f01-bc8b-4421-b2fb-5fa2b0b79a90",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "source": [
 | 
			
		||||
    "The input should be a triangle mesh or a quad mesh. This might takes a while depends on your design. You can adjust the `mesh_size` parameter in the `remesh` function."
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "code",
 | 
			
		||||
   "execution_count": 10,
 | 
			
		||||
   "id": "4ba2345b-dac3-45e6-a28e-123929f70b93",
 | 
			
		||||
   "metadata": {
 | 
			
		||||
    "scrolled": true,
 | 
			
		||||
    "tags": []
 | 
			
		||||
   },
 | 
			
		||||
   "outputs": [
 | 
			
		||||
    {
 | 
			
		||||
     "name": "stdout",
 | 
			
		||||
     "output_type": "stream",
 | 
			
		||||
     "text": [
 | 
			
		||||
      "Info    : Classifying surfaces (angle: 180)...\n",
 | 
			
		||||
      "Info    : Splitting triangulations to make them parametrizable:\n",
 | 
			
		||||
      "Info    :  - Level 0 partition with 3978 triangles split in 2 parts because poincare characteristic 2 is not 0\n",
 | 
			
		||||
      "Info    : Model has 0 non manifold mesh edges and 3786 boundary mesh edges\n",
 | 
			
		||||
      "Info    : Found 2 model surfaces\n",
 | 
			
		||||
      "Info    : Found 3 model curves\n",
 | 
			
		||||
      "Info    : Done classifying surfaces (Wall 0.0693158s, CPU 0.069573s)\n",
 | 
			
		||||
      "Info    : Creating geometry of discrete curves...\n",
 | 
			
		||||
      "Info    : Done creating geometry of discrete curves (Wall 0.000228139s, CPU 0.000371s)\n",
 | 
			
		||||
      "Info    : Creating geometry of discrete surfaces...\n",
 | 
			
		||||
      "Info    : [  0%] Creating geometry                                          \r",
 | 
			
		||||
      "Info    : [ 50%] Creating geometry                                          \r",
 | 
			
		||||
      "Info    : Done creating geometry of discrete surfaces (Wall 0.0322831s, CPU 0.032606s)\n",
 | 
			
		||||
      "Info    : Meshing 1D...\n",
 | 
			
		||||
      "Info    : [  0%] Meshing curve 5 (Discrete curve)\n",
 | 
			
		||||
      "Info    : [ 20%] Meshing curve 6 (Discrete curve)\n",
 | 
			
		||||
      "Info    : [ 40%] Meshing curve 7 (Discrete curve)\n",
 | 
			
		||||
      "Info    : [ 50%] Meshing curve 8 (Discrete curve)\n"
 | 
			
		||||
     ]
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
     "name": "stderr",
 | 
			
		||||
     "output_type": "stream",
 | 
			
		||||
     "text": [
 | 
			
		||||
      "Warning : Poor input mesh quality (min gamma = 0.000204069) for computing parametrization\n",
 | 
			
		||||
      "Warning : Poor input mesh quality (min gamma = 0.000204069) for computing parametrization\n"
 | 
			
		||||
     ]
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
     "name": "stdout",
 | 
			
		||||
     "output_type": "stream",
 | 
			
		||||
     "text": [
 | 
			
		||||
      "Info    : [ 70%] Meshing curve 9 (Discrete curve)\n",
 | 
			
		||||
      "Info    : [ 90%] Meshing curve 10 (Discrete curve)\n",
 | 
			
		||||
      "Info    : Done meshing 1D (Wall 0.100252s, CPU 0.100165s)\n",
 | 
			
		||||
      "Info    : Meshing 2D...\n",
 | 
			
		||||
      "Info    : [  0%] Meshing surface 2 (Discrete surface, Frontal-Delaunay)\n",
 | 
			
		||||
      "Info    : [  0%] Meshing surface 2 (Discrete surface, MeshAdapt)\n"
 | 
			
		||||
     ]
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
     "name": "stderr",
 | 
			
		||||
     "output_type": "stream",
 | 
			
		||||
     "text": [
 | 
			
		||||
      "Warning : 4752 elements remain invalid in surface 2\n"
 | 
			
		||||
     ]
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
     "name": "stdout",
 | 
			
		||||
     "output_type": "stream",
 | 
			
		||||
     "text": [
 | 
			
		||||
      "Info    : [ 50%] Meshing surface 3 (Discrete surface, Frontal-Delaunay)\n",
 | 
			
		||||
      "Info    : Done meshing 2D (Wall 20.1908s, CPU 20.176s)\n",
 | 
			
		||||
      "Info    : 12214 nodes 24512 elements\n"
 | 
			
		||||
     ]
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
     "name": "stderr",
 | 
			
		||||
     "output_type": "stream",
 | 
			
		||||
     "text": [
 | 
			
		||||
      "Warning : ------------------------------\n",
 | 
			
		||||
      "Warning : Mesh generation error summary\n",
 | 
			
		||||
      "Warning :     1 warning\n",
 | 
			
		||||
      "Warning :     0 errors\n",
 | 
			
		||||
      "Warning : Check the full log for details\n",
 | 
			
		||||
      "Warning : ------------------------------\n"
 | 
			
		||||
     ]
 | 
			
		||||
    }
 | 
			
		||||
   ],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "remesh_output_name = \"../data/remesh.obj\"\n",
 | 
			
		||||
    "remesh(blender_input_filename, remesh_output_name)"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "code",
 | 
			
		||||
   "execution_count": 11,
 | 
			
		||||
   "id": "245e2f45-c1ee-4f9f-86cd-e7fd9a0404de",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "outputs": [
 | 
			
		||||
    {
 | 
			
		||||
     "data": {
 | 
			
		||||
      "application/vnd.jupyter.widget-view+json": {
 | 
			
		||||
       "model_id": "ddb1c83810f241d69cfb63f6c5fda32e",
 | 
			
		||||
       "version_major": 2,
 | 
			
		||||
       "version_minor": 0
 | 
			
		||||
      },
 | 
			
		||||
      "text/plain": [
 | 
			
		||||
       "Renderer(camera=PerspectiveCamera(aspect=1.5, children=(DirectionalLight(color='white', intensity=0.6, positio…"
 | 
			
		||||
      ]
 | 
			
		||||
     },
 | 
			
		||||
     "metadata": {},
 | 
			
		||||
     "output_type": "display_data"
 | 
			
		||||
    }
 | 
			
		||||
   ],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "v,f = igl.read_triangle_mesh(remesh_output_name)\n",
 | 
			
		||||
    "p2 = plot(v, f, shading={\"wireframe\": True,\"width\": 900, \"height\": 600}, return_plot=True, c=mesh_color)"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "markdown",
 | 
			
		||||
   "id": "117e73d7-f291-4aa1-b783-cf8e2ae70a21",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "source": [
 | 
			
		||||
    "### Run optimization"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "code",
 | 
			
		||||
   "execution_count": null,
 | 
			
		||||
   "id": "632ea182-feb9-46b0-b2b5-83b32e65f9b7",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": []
 | 
			
		||||
  }
 | 
			
		||||
 ],
 | 
			
		||||
 "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.7"
 | 
			
		||||
  }
 | 
			
		||||
 },
 | 
			
		||||
 "nbformat": 4,
 | 
			
		||||
 "nbformat_minor": 5
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user