{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "%matplotlib inline"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "# Computing Mesh Quality {#mesh_quality_example}\n\nLeverage powerful VTK algorithms for computing mesh quality.\n\nHere we will use the\n`pyvista.DataSetFilters.compute_cell_quality`{.interpreted-text\nrole=\"func\"} filter to compute the cell qualities. For a full list of\nthe various quality metrics available, please refer to the documentation\nfor that filter.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "from pyvista import examples\n\nmesh = examples.download_cow().triangulate().decimate(0.7)\n\ncpos = [\n    (10.10963531890468, 4.61130688407898, -4.503884867626516),\n    (1.2896420468715433, -0.055387528972708225, 1.1228250502811408),\n    (-0.2970769821136617, 0.9100381451936025, 0.2890948650371137),\n]"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Compute the cell quality. Note that there are many different quality\nmeasures\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "qual = mesh.compute_cell_quality(quality_measure='scaled_jacobian')\nqual"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "qual.plot(cpos=cpos, scalars='CellQuality')"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "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.12.2"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}