Example #1
0
def getManipulatedPaths(close, loop, prefix, sideLength, xmlElement):
    "Get segment loop."
    if len(loop) < 3:
        return [loop]
    path = evaluate.getPathByPrefix(getSegmentPathDefault(), prefix,
                                    xmlElement)
    if path == getSegmentPathDefault():
        return [loop]
    path = getXNormalizedVector3Path(path)
    segmentCenter = evaluate.getVector3ByPrefix(None, prefix + 'center',
                                                xmlElement)
    if euclidean.getIsWiddershinsByVector3(loop):
        path = path[::-1]
        for point in path:
            point.x = 1.0 - point.x
            if segmentCenter == None:
                point.y = -point.y
    segmentLoop = []
    startEnd = StartEnd(len(loop), prefix, xmlElement)
    for pointIndex in xrange(len(loop)):
        if pointIndex >= startEnd.start and pointIndex < startEnd.end:
            segmentLoop += getSegmentPath(loop, path, pointIndex,
                                          segmentCenter)
        else:
            segmentLoop.append(loop[pointIndex])
    return [euclidean.getLoopWithoutCloseSequentialPoints(close, segmentLoop)]
Example #2
0
	def getByPrefixZ( self, path, prefix, xmlElement ):
		"Get interpolation from prefix and xml element in the z direction."
		if len( path ) < 2:
			print('Warning, path is too small in evaluate in Interpolation.')
			return
		self.path = evaluate.getPathByPrefix( path, prefix, xmlElement )
		self.distances = []
		for point in self.path:
			self.distances.append( point.z )
		return self.getByDistances()
Example #3
0
	def getByPrefixAlong( self, path, prefix, xmlElement ):
		"Get interpolation from prefix and xml element along the path."
		if len( path ) < 2:
			print('Warning, path is too small in evaluate in Interpolation.')
			return
		self.path = evaluate.getPathByPrefix( path, prefix, xmlElement )
		self.distances = [ 0.0 ]
		previousPoint = self.path[0]
		for point in self.path[ 1 : ]:
			distanceDifference = abs( point - previousPoint )
			self.distances.append( self.distances[ - 1 ] + distanceDifference )
			previousPoint = point
		return self.getByDistances()
Example #4
0
def getSegmentLoop( close, loop, xmlElement ):
	"Get segment loop."
	path = evaluate.getPathByPrefix( getSegmentPathDefault(), 'segment', xmlElement )
	if path == getSegmentPathDefault():
		return loop
	path = getXNormalizedVector3Path( path )
	segmentCenter = evaluate.getVector3ByKey( 'segmentcenter', None, xmlElement )
	if euclidean.getIsWiddershinsByVector3( loop ):
		path = path[ : : - 1 ]
		for point in path:
			point.x = 1.0 - point.x
			if segmentCenter == None:
				point.y = - point.y
	segmentLoop = []
	for pointIndex in xrange( len( loop ) ):
		segmentLoop += getSegmentPath( loop, path, pointIndex, segmentCenter )
	return euclidean.getLoopWithoutCloseSequentialPoints( close, segmentLoop )
Example #5
0
def getManipulatedPaths(close, loop, prefix, sideLength, xmlElement):
	"Get segment loop."
	if len(loop) < 3:
		return [loop]
	path = evaluate.getPathByPrefix( getSegmentPathDefault(), prefix, xmlElement )
	if path == getSegmentPathDefault():
		return [loop]
	path = getXNormalizedVector3Path(path)
	segmentCenter = evaluate.getVector3ByPrefix( prefix + 'center', None, xmlElement )
	if euclidean.getIsWiddershinsByVector3(loop):
		path = path[: : -1]
		for point in path:
			point.x = 1.0 - point.x
			if segmentCenter == None:
				point.y = - point.y
	segmentLoop = []
	startEnd = lineation.StartEnd( len(loop), prefix, xmlElement )
	for pointIndex in xrange(len(loop)):
		if pointIndex >= startEnd.start and pointIndex < startEnd.end:
			segmentLoop += getSegmentPath( loop, path, pointIndex, segmentCenter )
		else:
			segmentLoop.append( loop[pointIndex] )
	return [ euclidean.getLoopWithoutCloseSequentialPoints( close, segmentLoop ) ]
Example #6
0
 def __init__(self, elementNode, prefix):
     'Set defaults.'
     self.center = evaluate.getVector3ByPrefix(None, elementNode,
                                               prefix + 'center')
     self.path = evaluate.getPathByPrefix(elementNode,
                                          getSegmentPathDefault(), prefix)
Example #7
0
	def __init__(self, elementNode, prefix):
		'Set defaults.'
		self.center = evaluate.getVector3ByPrefix(None, elementNode, prefix + 'center')
		self.path = evaluate.getPathByPrefix(elementNode, getSegmentPathDefault(), prefix)