# Path: Generic/Kernel/GeoUtil/tolerance.py
# TOL = 1e-10


import random
import string 
import types
from math import fmod, pi
from .tolerance import TOL
        from Kernel.GeoEntity.segment import Segment
        from Kernel.GeoEntity.point import Point
        from Kernel.GeoUtil.geolib import Vector
    return False

def to_unicode(obj, encoding='utf-8'):
    """
        Transform a string in a different format Default utf-8
    """
    if isinstance(obj, basestring):
        if not isinstance(obj, unicode):
            obj = obj.replace('\x00', '').decode(encoding, 'ignore').encode(encoding)
        return obj
    raise TypeError("Invalid object type : " + str(type(obj)))

def getRandomString(lengh = None):
    """
        get a random name 
    """
    random.seed(14)
    if lengh == None:
        lengh = 10
    d = [random.choice(string.letters) for x in range(lengh)]
    return "".join(d)


def getSegmentNearestPoint(segment, p):
    """
        get the segment nearest end point
    """
    ps1, ps2 = segment.getEndpoints()
    dist1 = ps1.dist(p)
    dist2 = ps2.dist(p)

# Path: Generic/Kernel/GeoUtil/tolerance.py
# TOL = 1e-10


# Path: Generic/Kernel/GeoUtil/util.py
import random
import string 
import types
from math import fmod, pi
from .tolerance import TOL
        from Kernel.GeoEntity.segment import Segment
        from Kernel.GeoEntity.point import Point
        from Kernel.GeoUtil.geolib import Vector

    return False

def to_unicode(obj, encoding='utf-8'):
    """
        Transform a string in a different format Default utf-8
    """
    if isinstance(obj, basestring):
        if not isinstance(obj, unicode):
            obj = obj.replace('\x00', '').decode(encoding, 'ignore').encode(encoding)
        return obj
    raise TypeError("Invalid object type : " + str(type(obj)))

def getRandomString(lengh = None):
    """
        get a random name 
    """
    random.seed(14)
    if lengh == None:
        lengh = 10
    d = [random.choice(string.letters) for x in range(lengh)]
    return "".join(d)


def getSegmentNearestPoint(segment, p):
    """
        get the segment nearest end point
    """
    ps1, ps2 = segment.getEndpoints()
    dist1 = ps1.dist(p)
    dist2 = ps2.dist(p)

    if (dist1 - dist2 < TOL):