# This file was automatically generated by SWIG (https://www.swig.org).
# Version 4.2.1
#
# Do not make changes to this file unless you know what you are doing - modify
# the SWIG interface file instead.

"""
CSLib module, see official documentation at
https://www.opencascade.com/doc/occt-7.7.0/refman/html/package_cslib.html
"""

from sys import version_info as _swig_python_version_info
# Import the low-level C/C++ module
if __package__ or "." in __name__:
    from . import _CSLib
else:
    import _CSLib

try:
    import builtins as __builtin__
except ImportError:
    import __builtin__

def _swig_repr(self):
    try:
        strthis = "proxy of " + self.this.__repr__()
    except __builtin__.Exception:
        strthis = ""
    return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)


def _swig_setattr_nondynamic_instance_variable(set):
    def set_instance_attr(self, name, value):
        if name == "this":
            set(self, name, value)
        elif name == "thisown":
            self.this.own(value)
        elif hasattr(self, name) and isinstance(getattr(type(self), name), property):
            set(self, name, value)
        else:
            raise AttributeError("You cannot add instance attributes to %s" % self)
    return set_instance_attr


def _swig_setattr_nondynamic_class_variable(set):
    def set_class_attr(cls, name, value):
        if hasattr(cls, name) and not isinstance(getattr(cls, name), property):
            set(cls, name, value)
        else:
            raise AttributeError("You cannot add class attributes to %s" % cls)
    return set_class_attr


def _swig_add_metaclass(metaclass):
    """Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass"""
    def wrapper(cls):
        return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())
    return wrapper


class _SwigNonDynamicMeta(type):
    """Meta class to enforce nondynamic attributes (no new attributes) for a class"""
    __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)


class SwigPyIterator(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")

    def __init__(self, *args, **kwargs):
        raise AttributeError("No constructor defined - class is abstract")
    __repr__ = _swig_repr
    __swig_destroy__ = _CSLib.delete_SwigPyIterator

    def value(self):
        return _CSLib.SwigPyIterator_value(self)

    def incr(self, n=1):
        return _CSLib.SwigPyIterator_incr(self, n)

    def decr(self, n=1):
        return _CSLib.SwigPyIterator_decr(self, n)

    def distance(self, x):
        return _CSLib.SwigPyIterator_distance(self, x)

    def equal(self, x):
        return _CSLib.SwigPyIterator_equal(self, x)

    def copy(self):
        return _CSLib.SwigPyIterator_copy(self)

    def next(self):
        return _CSLib.SwigPyIterator_next(self)

    def __next__(self):
        return _CSLib.SwigPyIterator___next__(self)

    def previous(self):
        return _CSLib.SwigPyIterator_previous(self)

    def advance(self, n):
        return _CSLib.SwigPyIterator_advance(self, n)

    def __eq__(self, x):
        return _CSLib.SwigPyIterator___eq__(self, x)

    def __ne__(self, x):
        return _CSLib.SwigPyIterator___ne__(self, x)

    def __iadd__(self, n):
        return _CSLib.SwigPyIterator___iadd__(self, n)

    def __isub__(self, n):
        return _CSLib.SwigPyIterator___isub__(self, n)

    def __add__(self, n):
        return _CSLib.SwigPyIterator___add__(self, n)

    def __sub__(self, *args):
        return _CSLib.SwigPyIterator___sub__(self, *args)
    def __iter__(self):
        return self

# Register SwigPyIterator in _CSLib:
_CSLib.SwigPyIterator_swigregister(SwigPyIterator)

def _dumps_object(klass):
    """ Overwrite default string output for any wrapped object.
    By default, __repr__ method returns something like:
    <OCC.Core.TopoDS.TopoDS_Shape; proxy of <Swig Object of type 'TopoDS_Shape *' at 0x02BB0758> >
    This is too much verbose.
    We prefer :
    <class 'gp_Pnt'>
    or
    <class 'TopoDS_Shape'>
    """
    klass_name = str(klass.__class__).split(".")[3].split("'")[0]
    repr_string = "<class '" + klass_name + "'"
# for TopoDS_Shape, we also look for the base type
    if klass_name == "TopoDS_Shape":
        if klass.IsNull():
            repr_string += ": Null>"
            return repr_string
        st = klass.ShapeType()
        types = {OCC.Core.TopAbs.TopAbs_VERTEX: "Vertex",
                 OCC.Core.TopAbs.TopAbs_SOLID: "Solid",
                 OCC.Core.TopAbs.TopAbs_EDGE: "Edge",
                 OCC.Core.TopAbs.TopAbs_FACE: "Face",
                 OCC.Core.TopAbs.TopAbs_SHELL: "Shell",
                 OCC.Core.TopAbs.TopAbs_WIRE: "Wire",
                 OCC.Core.TopAbs.TopAbs_COMPOUND: "Compound",
                 OCC.Core.TopAbs.TopAbs_COMPSOLID: "Compsolid"}
        repr_string += "; Type:%s" % types[st]        
    elif hasattr(klass, "IsNull"):
        if klass.IsNull():
            repr_string += "; Null"
    repr_string += ">"
    return repr_string


def process_exception(error, method_name, class_name):
    return _CSLib.process_exception(error, method_name, class_name)

from six import with_metaclass
import warnings
from OCC.Wrapper.wrapper_utils import Proxy, deprecated

import OCC.Core.Standard
import OCC.Core.NCollection
import OCC.Core.TColgp
import OCC.Core.gp
import OCC.Core.TColStd
import OCC.Core.TCollection
import OCC.Core.math
import OCC.Core.Message
import OCC.Core.OSD

from enum import IntEnum
from OCC.Core.Exception import *

CSLib_Done = _CSLib.CSLib_Done
CSLib_D1uIsNull = _CSLib.CSLib_D1uIsNull
CSLib_D1vIsNull = _CSLib.CSLib_D1vIsNull
CSLib_D1IsNull = _CSLib.CSLib_D1IsNull
CSLib_D1uD1vRatioIsNull = _CSLib.CSLib_D1uD1vRatioIsNull
CSLib_D1vD1uRatioIsNull = _CSLib.CSLib_D1vD1uRatioIsNull
CSLib_D1uIsParallelD1v = _CSLib.CSLib_D1uIsParallelD1v
CSLib_Singular = _CSLib.CSLib_Singular
CSLib_Defined = _CSLib.CSLib_Defined
CSLib_InfinityOfSolutions = _CSLib.CSLib_InfinityOfSolutions
CSLib_D1NuIsNull = _CSLib.CSLib_D1NuIsNull
CSLib_D1NvIsNull = _CSLib.CSLib_D1NvIsNull
CSLib_D1NIsNull = _CSLib.CSLib_D1NIsNull
CSLib_D1NuNvRatioIsNull = _CSLib.CSLib_D1NuNvRatioIsNull
CSLib_D1NvNuRatioIsNull = _CSLib.CSLib_D1NvNuRatioIsNull
CSLib_D1NuIsParallelD1Nv = _CSLib.CSLib_D1NuIsParallelD1Nv


class CSLib_DerivativeStatus(IntEnum):
	CSLib_Done = 0
	CSLib_D1uIsNull = 1
	CSLib_D1vIsNull = 2
	CSLib_D1IsNull = 3
	CSLib_D1uD1vRatioIsNull = 4
	CSLib_D1vD1uRatioIsNull = 5
	CSLib_D1uIsParallelD1v = 6
CSLib_Done = CSLib_DerivativeStatus.CSLib_Done
CSLib_D1uIsNull = CSLib_DerivativeStatus.CSLib_D1uIsNull
CSLib_D1vIsNull = CSLib_DerivativeStatus.CSLib_D1vIsNull
CSLib_D1IsNull = CSLib_DerivativeStatus.CSLib_D1IsNull
CSLib_D1uD1vRatioIsNull = CSLib_DerivativeStatus.CSLib_D1uD1vRatioIsNull
CSLib_D1vD1uRatioIsNull = CSLib_DerivativeStatus.CSLib_D1vD1uRatioIsNull
CSLib_D1uIsParallelD1v = CSLib_DerivativeStatus.CSLib_D1uIsParallelD1v

class CSLib_NormalStatus(IntEnum):
	CSLib_Singular = 0
	CSLib_Defined = 1
	CSLib_InfinityOfSolutions = 2
	CSLib_D1NuIsNull = 3
	CSLib_D1NvIsNull = 4
	CSLib_D1NIsNull = 5
	CSLib_D1NuNvRatioIsNull = 6
	CSLib_D1NvNuRatioIsNull = 7
	CSLib_D1NuIsParallelD1Nv = 8
CSLib_Singular = CSLib_NormalStatus.CSLib_Singular
CSLib_Defined = CSLib_NormalStatus.CSLib_Defined
CSLib_InfinityOfSolutions = CSLib_NormalStatus.CSLib_InfinityOfSolutions
CSLib_D1NuIsNull = CSLib_NormalStatus.CSLib_D1NuIsNull
CSLib_D1NvIsNull = CSLib_NormalStatus.CSLib_D1NvIsNull
CSLib_D1NIsNull = CSLib_NormalStatus.CSLib_D1NIsNull
CSLib_D1NuNvRatioIsNull = CSLib_NormalStatus.CSLib_D1NuNvRatioIsNull
CSLib_D1NvNuRatioIsNull = CSLib_NormalStatus.CSLib_D1NvNuRatioIsNull
CSLib_D1NuIsParallelD1Nv = CSLib_NormalStatus.CSLib_D1NuIsParallelD1Nv

class cslib(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    @staticmethod
    def DNNUV(*args):
        r"""

        Parameters
        ----------
        Nu: int
        Nv: int
        DerSurf: TColgp_Array2OfVec

        Return
        -------
        gp_Vec

        Description
        -----------
        -- computes the derivative of order nu in the -- direction u and nv in the direction v of the not -- normalized normal vector at the point p(u,v) the array dersurf contain the derivative (i,j) of the surface for i=0,nu+1 ; j=0,nv+1.

        Parameters
        ----------
        Nu: int
        Nv: int
        DerSurf1: TColgp_Array2OfVec
        DerSurf2: TColgp_Array2OfVec

        Return
        -------
        gp_Vec

        Description
        -----------
        Computes the derivatives of order nu in the direction nu and nv in the direction nv of the not normalized vector n(u,v) = ds1/du * ds2/dv (cases where we use an osculating surface) dersurf1 are the derivatives of s1.

        """
        return _CSLib.cslib_DNNUV(*args)

    @staticmethod
    def DNNormal(*args):
        r"""

        Parameters
        ----------
        Nu: int
        Nv: int
        DerNUV: TColgp_Array2OfVec
        Iduref: int (optional, default to 0)
        Idvref: int (optional, default to 0)

        Return
        -------
        gp_Vec

        Description
        -----------
        -- computes the derivative of order nu in the -- direction u and nv in the direction v of the normalized normal vector at the point p(u,v) array dernuv contain the derivative (i+iduref,j+idvref) of d1u ^ d1v for i=0,nu ; j=0,nv iduref and idvref correspond to a derivative of d1u ^ d1v which can be used to compute the normalized normal vector. in the regular cases , iduref=idvref=0.

        """
        return _CSLib.cslib_DNNormal(*args)

    @staticmethod
    def Normal(*args):
        r"""

        Parameters
        ----------
        D1U: gp_Vec
        D1V: gp_Vec
        SinTol: float
        Normal: gp_Dir

        Return
        -------
        theStatus: CSLib_DerivativeStatus

        Description
        -----------
        The following functions computes the normal to a surface inherits functionwithderivative from math //! computes the normal direction of a surface as the cross product between d1u and d1v. if d1u has null length or d1v has null length or d1u and d1v are parallel the normal is undefined. to check that d1u and d1v are colinear the sinus of the angle between d1u and d1v is computed and compared with sintol. the normal is computed if thestatus == done else the thestatus gives the reason why the computation has failed.

        Parameters
        ----------
        D1U: gp_Vec
        D1V: gp_Vec
        D2U: gp_Vec
        D2V: gp_Vec
        D2UV: gp_Vec
        SinTol: float
        Normal: gp_Dir

        Return
        -------
        Done: bool
        theStatus: CSLib_NormalStatus

        Description
        -----------
        If there is a singularity on the surface the previous method cannot compute the local normal. this method computes an approached normal direction of a surface. it does a limited development and needs the second derivatives on the surface as input data. it computes the normal as follow: n(u, v) = d1u ^ d1v n(u0+du,v0+dv) = n0 + dn/du(u0,v0) * du + dn/dv(u0,v0) * dv + eps with eps->0 so we can have the equivalence n ~ dn/du + dn/dv. dnu = ||dn/du|| and dnv = ||dn/dv|| //! . if dnu isnull (dnu <= resolution from gp) the answer done = true the normal direction is given by dn/dv . if dnv isnull (dnv <= resolution from gp) the answer done = true the normal direction is given by dn/du . if the two directions dn/du and dn/dv are parallel done = true the normal direction is given either by dn/du or dn/dv. to check that the two directions are colinear the sinus of the angle between these directions is computed and compared with sintol. . if dnu/dnv or dnv/dnu is lower or equal than real epsilon done = false, the normal is undefined . if dnu isnull and dnv is null done = false, there is an indetermination and we should do a limited development at order 2 (it means that we cannot omit eps). . if dnu is not null and dnv is not null done = false, there are an infinity of normals at the considered point on the surface.

        Parameters
        ----------
        D1U: gp_Vec
        D1V: gp_Vec
        MagTol: float
        Normal: gp_Dir

        Return
        -------
        theStatus: CSLib_NormalStatus

        Description
        -----------
        Computes the normal direction of a surface as the cross product between d1u and d1v.

        Parameters
        ----------
        MaxOrder: int
        DerNUV: TColgp_Array2OfVec
        MagTol: float
        U: float
        V: float
        Umin: float
        Umax: float
        Vmin: float
        Vmax: float
        Normal: gp_Dir

        Return
        -------
        theStatus: CSLib_NormalStatus
        OrderU: int
        OrderV: int

        Description
        -----------
        Find the first order k0 of deriviative of nuv where: foreach order < k0 all the derivatives of nuv are null all the derivatives of nuv corresponding to the order k0 are collinear and have the same sens. in this case, normal at u,v is unique.

        """
        return _CSLib.cslib_Normal(*args)

    __repr__ = _dumps_object


    def __init__(self):
        _CSLib.cslib_swiginit(self, _CSLib.new_cslib())
    __swig_destroy__ = _CSLib.delete_cslib

# Register cslib in _CSLib:
_CSLib.cslib_swigregister(cslib)
class CSLib_Class2d(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self, *args):
        r"""

        Parameters
        ----------
        thePnts2d: TColgp_Array1OfPnt2d
        theTolU: float
        theTolV: float
        theUMin: float
        theVMin: float
        theUMax: float
        theVMax: float

        Return
        -------
        None

        Description
        -----------
        Constructs the 2d-polygon. thepnts2d is the set of the vertices (closed polygon will always be created inside of this constructor; consequently, there is no point in repeating first and last point in thepnts2d). thetolu and thetolv are tolerances. theumin, thevmin, theumax, thevmax are uv-bounds of the polygon.

        Parameters
        ----------
        thePnts2d: TColgp_SequenceOfPnt2d
        theTolU: float
        theTolV: float
        theUMin: float
        theVMin: float
        theUMax: float
        theVMax: float

        Return
        -------
        None

        Description
        -----------
        Constructs the 2d-polygon. thepnts2d is the set of the vertices (closed polygon will always be created inside of this constructor; consequently, there is no point in repeating first and last point in thepnts2d). thetolu and thetolv are tolerances. theumin, thevmin, theumax, thevmax are uv-bounds of the polygon.

        """
        _CSLib.CSLib_Class2d_swiginit(self, _CSLib.new_CSLib_Class2d(*args))

    def InternalSiDans(self, *args):
        r"""

        Parameters
        ----------
        X: float
        Y: float

        Return
        -------
        int

        Description
        -----------
        No available documentation.

        """
        return _CSLib.CSLib_Class2d_InternalSiDans(self, *args)

    def InternalSiDansOuOn(self, *args):
        r"""

        Parameters
        ----------
        X: float
        Y: float

        Return
        -------
        int

        Description
        -----------
        No available documentation.

        """
        return _CSLib.CSLib_Class2d_InternalSiDansOuOn(self, *args)

    def SiDans(self, *args):
        r"""

        Parameters
        ----------
        P: gp_Pnt2d

        Return
        -------
        int

        Description
        -----------
        No available documentation.

        """
        return _CSLib.CSLib_Class2d_SiDans(self, *args)

    def SiDans_OnMode(self, *args):
        r"""

        Parameters
        ----------
        P: gp_Pnt2d
        Tol: float

        Return
        -------
        int

        Description
        -----------
        No available documentation.

        """
        return _CSLib.CSLib_Class2d_SiDans_OnMode(self, *args)

    __repr__ = _dumps_object

    __swig_destroy__ = _CSLib.delete_CSLib_Class2d

# Register CSLib_Class2d in _CSLib:
_CSLib.CSLib_Class2d_swigregister(CSLib_Class2d)
class CSLib_NormalPolyDef(OCC.Core.math.math_FunctionWithDerivative):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self, *args):
        r"""

        Parameters
        ----------
        k0: int
        li: TColStd_Array1OfReal

        Return
        -------
        None

        Description
        -----------
        No available documentation.

        """
        _CSLib.CSLib_NormalPolyDef_swiginit(self, _CSLib.new_CSLib_NormalPolyDef(*args))

    __repr__ = _dumps_object

    __swig_destroy__ = _CSLib.delete_CSLib_NormalPolyDef

# Register CSLib_NormalPolyDef in _CSLib:
_CSLib.CSLib_NormalPolyDef_swigregister(CSLib_NormalPolyDef)



@deprecated
def cslib_DNNUV(*args):
	return cslib.DNNUV(*args)

@deprecated
def cslib_DNNUV(*args):
	return cslib.DNNUV(*args)

@deprecated
def cslib_DNNormal(*args):
	return cslib.DNNormal(*args)

@deprecated
def cslib_Normal(*args):
	return cslib.Normal(*args)

@deprecated
def cslib_Normal(*args):
	return cslib.Normal(*args)

@deprecated
def cslib_Normal(*args):
	return cslib.Normal(*args)

@deprecated
def cslib_Normal(*args):
	return cslib.Normal(*args)



