.. role:: ts-api-decorator

##########
Isosurface
##########

.. js:module:: cee.ug
   :noindex:

.. container:: ts-api-section

   .. js:class:: Isosurface

      Specification of an isosurface (both parameters and attributes) in a ``RemoteModel``.

      Use this object to control the settings and attributes of an isosurface. The isosurface is defined
      by specifying the scalar to compute from (with ``isoScalarResultId``) and the value to compute the surface
      for (with ``isoValue``). The result is a surface within the model containing all points where the scalar
      result has the given value.

      You can map any scalar result onto the isosurface with ``mapScalarResultId`` and also map
      a vector result with ``mapVectorResultId``. The settings for the mapped results can 
      be controlled with the ``ScalarSettings`` and ``VectorSettings`` objects.

      To create an isosurface, use ``RemoteModel.addIsosurface``.

      **Example:** Show an isosurface


      .. code-block:: javascript

         var modelDir = myModel.modelDirectory;

         // Add iso surface if we have a scalar result
         if (modelDir.scalarResultArray.length > 0) {
             var iso = myModel.addIsosurface();
             iso.isoScalarResultId = modelDir.scalarResultArray[0].id;
    
             if (myModel.getScalarResultMinimumValue(iso.isoScalarResultId) != undefined) {
                 iso.isoValue = (myModel.getScalarResultMinimumValue(iso.isoScalarResultId) 
                       + myModel.getScalarResultMaximumValue(iso.isoScalarResultId))/2;
             } else {
                 iso.isoValue = 0.5;
             }
    
             if (modelDir.scalarResultArray.length > 1) {
                 iso.mapScalarResultId = modelDir.scalarResultArray[1].id;
             } else {
                 iso.mapScalarResultId = modelDir.scalarResultArray[0].id;
             }
         }

         // Set model to outline to show the cutting planes
         myModel.setDrawStyleAllParts(cee.ug.DrawStyle.OUTLINE);

 
      This code sample produces the following image in the 3D Viewer:

      .. image:: /images/Isosurface.png





.. container:: api-index-section

   .. rubric:: Accessors

   .. rst-class:: api-index-list-item api-kind-accessor api-parent-kind-class

   * :js:attr:`~cee.ug.Isosurface.computeFromVisibleParts`
   * :js:attr:`~cee.ug.Isosurface.highlight`
   * :js:attr:`~cee.ug.Isosurface.id`
   * :js:attr:`~cee.ug.Isosurface.isoScalarResultId`
   * :js:attr:`~cee.ug.Isosurface.isoValue`
   * :js:attr:`~cee.ug.Isosurface.isPrecomputed`
   * :js:attr:`~cee.ug.Isosurface.mapContourLinesResultId`
   * :js:attr:`~cee.ug.Isosurface.mapScalarResultId`
   * :js:attr:`~cee.ug.Isosurface.mapVectorResultId`
   * :js:attr:`~cee.ug.Isosurface.opacity`
   * :js:attr:`~cee.ug.Isosurface.surfaceColor`
   * :js:attr:`~cee.ug.Isosurface.visible`



.. container:: api-index-section

   .. rubric:: Methods

   .. rst-class:: api-index-list-item api-kind-method api-parent-kind-class

   * :js:meth:`~cee.ug.Isosurface.getAsProperties`
   * :js:meth:`~cee.ug.Isosurface.setFromProperties`





------------

Accessors
=========

.. container:: ts-api-section

   .. js:function:: Isosurface.computeFromVisibleParts()



      If set to true, the isosurface will be computed from only the visible parts. Any part that
      is not visible will not contribute to the isosurface.


      :rtype: boolean

   .. js:function:: Isosurface.computeFromVisibleParts( visiblePartsOnly)

      :param visiblePartsOnly: None
      :type visiblePartsOnly: boolean


      :rtype: void



.. container:: ts-api-section

   .. js:function:: Isosurface.highlight()



      Whether the isosurface should be highlighted.


      :rtype: boolean

   .. js:function:: Isosurface.highlight( highlight)

      :param highlight: None
      :type highlight: boolean


      :rtype: void



.. container:: ts-api-section

   .. js:function:: Isosurface.id()



      The id of the isosurface. This is assigned by the system when you call ``RemoteModel.addIsosurface``
      and is used to identify the isosurface.


      :rtype: number



.. container:: ts-api-section

   .. js:function:: Isosurface.isoScalarResultId()



      The scalar result to compute the isosurface from. This property is mandatory and must refer to one 
      of the scalar results in ``ModelDirectory.scalarResultArray``.


      :rtype: number

   .. js:function:: Isosurface.isoScalarResultId( isoScalarResultId)

      :param isoScalarResultId: None
      :type isoScalarResultId: number


      :rtype: void



.. container:: ts-api-section

   .. js:function:: Isosurface.isoValue()



      The value to compute the isosurface from. The value of the scalar result with id ``isoScalarResultId``
      will be equal to this value at all points on the isosurface.


      :rtype: number

   .. js:function:: Isosurface.isoValue( isoValue)

      :param isoValue: None
      :type isoValue: number


      :rtype: void



.. container:: ts-api-section

   .. js:function:: Isosurface.isPrecomputed()



      Is true if the isosurface is precomputed and cannot be changed


      :rtype: boolean



.. todo:: Implement None cee.ug.Isosurface.mapContourLinesResultId ('target')

.. container:: ts-api-section

   .. js:function:: Isosurface.mapScalarResultId()



      The id of the scalar result to show on the isosurface. 

      This id must refer to one of the scalar results in ``ModelDirectory.scalarResultArray``.
      You can change the settings for the scalar with the ``ScalarSettings`` object.

      Set to -1 to show no scalars on the isosurface.


      :rtype: number

   .. js:function:: Isosurface.mapScalarResultId( mapScalarResultId)

      :param mapScalarResultId: None
      :type mapScalarResultId: number


      :rtype: void



.. container:: ts-api-section

   .. js:function:: Isosurface.mapVectorResultId()



      The id of the vector result to show on the isosurface. One vector will be shown in each node of the surface. 

      This id must refer to one of the vector results in ``ModelDirectory.vectorResultArray``.
      The settings for the vector arrows can be changed with the ``VectorSettings`` object.

      Set to -1 to show no vectors on the isosurface.


      :rtype: number

   .. js:function:: Isosurface.mapVectorResultId( mapVectorResultId)

      :param mapVectorResultId: None
      :type mapVectorResultId: number


      :rtype: void



.. container:: ts-api-section

   .. js:function:: Isosurface.opacity()



      Opacity of the isosurface. 0.0 means fully transparent (invisible), 1.0 means fully opaque.


      :rtype: number

   .. js:function:: Isosurface.opacity( opacity)

      :param opacity: None
      :type opacity: number


      :rtype: void



.. container:: ts-api-section

   .. js:function:: Isosurface.surfaceColor()



      The color of the isosurface if not showing a result (mapScalarResultId = -1)


      :rtype: Color3Like

   .. js:function:: Isosurface.surfaceColor( clr)

      :param clr: None
      :type clr: Color3Like


      :rtype: void



.. container:: ts-api-section

   .. js:function:: Isosurface.visible()



      Visibility of the isosurface. Use this to show or hide an isosurface in the 3D Viewer.


      :rtype: boolean

   .. js:function:: Isosurface.visible( visible)

      :param visible: None
      :type visible: boolean


      :rtype: void



Methods
=======

.. rst-class:: ts-api-section

getAsProperties
---------------

.. js:method:: Isosurface.getAsProperties()



   Gets the settings for this isosurface as a Plain Old JavaScript Object (POJO).


   :rtype: IsosurfaceProperties

.. rst-class:: ts-api-section

setFromProperties
-----------------

.. js:method:: Isosurface.setFromProperties( props)

   :param props: None
   :type props: Partial <IsosurfaceProperties>


   Applies the settings in the given properties object to this isosurface.


   :rtype: void

