skeinforge_tools.skeinforge_utilities.euclidean ($Date: 2008/21/04 $) | index /home/enrique/Desktop/backup/babbleold/script/reprap/pyRepRap/skeinforge_tools/skeinforge_utilities/euclidean.py

`Euclidean is a collection of python utilities for complex numbers, paths, polygons & Vector3s.
To use euclidean, install python 2.x on your machine, which is avaliable from http://www.python.org/download/
Then in the folder which euclidean is in, type 'python' in a shell to run the python interpreter. Finally type
'import euclidean' to import these utilities and 'from vector3 import Vector3' to import the Vector3 class.
Below are examples of euclidean use.
>>> from euclidean import *
>>> origin=complex()
>>> right=complex(1.0,0.0)
>>> back=complex(0.0,1.0)
>>> getMaximum(right,back)
1.0, 1.0
>>> polygon=[origin, right, back]
>>> getPolygonLength(polygon)
3.4142135623730949
>>> getPolygonArea(polygon)
0.5`

Modules
`` |  |
__init__ | math |  |

Classes
`` |  | DistanceIndex Endpoint LoopLayer PathZ RotatedLoopLayer SurroundingLoop XIntersectionIndex
class DistanceIndex
`` | `A class to hold the distance and the index of the loop.`
| Methods defined here: __init__(self, distance, index) __repr__(self) `Get the string representation of this distance index.`
class Endpoint
`` | `The endpoint of a segment.`
| Methods defined here: __repr__(self) `Get the string representation of this Endpoint.` getFromOtherPoint(self, otherEndpoint, point) `Initialize from other endpoint.` getHop(self, fillInset, path) `Get a hop away from the endpoint if the other endpoint is doubling back.` getNearestEndpoint(self, endpoints) `Get nearest endpoint.` getNearestMiss(self, endpoints, path, pixelTable, width) `Get the nearest endpoint which the segment to that endpoint misses the other extrusions.`
class LoopLayer
`` | `Loops with a z.`
| Methods defined here: __init__(self, z) __repr__(self) `Get the string representation of this loop layer.`
class PathZ
`` | `Complex path with a z.`
| Methods defined here: __init__(self, z) __repr__(self) `Get the string representation of this path z.`
class RotatedLoopLayer
`` | `A rotated layer.`
| Methods defined here: __init__(self, z) __repr__(self) `Get the string representation of this rotated loop layer.`
class SurroundingLoop
`` | `A loop that surrounds paths.`
| Methods defined here: __init__(self, isOutsideExtrudedFirst=True) __repr__(self) `Get the string representation of this surrounding loop.` addToBoundary(self, vector3) `Add vector3 to boundary.` addToLoop(self, vector3) `Add vector3 to loop.` addToThreads(self, oldOrderedLocation, skein) `Add to paths from the last location.` getFillLoops(self) `Get last fill loops from the outside loop and the loops inside the inside loops.` getFromInsideSurroundings(self, extrusionWidth, inputSurroundingInsides) `Initialize from inside surrounding loops.` getLoopsToBeFilled(self) `Get last fill loops from the outside loop and the loops inside the inside loops.` transferClosestFillLoops(self, oldOrderedLocation, skein) `Transfer closest fill loops.` transferPaths(self, paths) `Transfer paths.`
class XIntersectionIndex
`` | `A class to hold the x intersection position and the index of the loop which intersected.`
| Methods defined here: __cmp__(self, other) `Get comparison in order to sort x intersections in ascending order of x.` __init__(self, index, x) __repr__(self) `Get the string representation of this x intersection.`

Functions
`` |  | addCircleToPixelTable(pixelTable, pointComplex) `Add pixel to the pixel table.` addElementToPixelList(element, pixelTable, x, y) `Add an element to the pixel list.` addLoopToPixelTable(loop, pixelTable, width) `Add loop to the pixel table.` addPathToPixelTable(path, pixelTable, width) `Add path to the pixel table.` addPixelToPixelTable(pixelTable, value, x, y) `Add pixel to the pixel table.` addPixelToPixelTableWithSteepness(isSteep, pixelTable, x, y) `Add pixels to the pixel table with steepness.` addPointToPath(path, pixelTable, point, width) `Add a point to a path and the pixel table.` addSegmentToPixelTable(beginComplex, endComplex, pixelTable, shortenDistanceBegin, shortenDistanceEnd, width) `Add line segment to the pixel table.` addSurroundingLoopBeginning(loop, skein, z) `Add surrounding loop beginning to gcode output.` addToThreadsFromLoop(extrusionHalfWidth, gcodeType, loop, oldOrderedLocation, skein) `Add to threads from the last location from loop.` addToThreadsRemoveFromSurroundings(oldOrderedLocation, surroundingLoops, skein) `Add to threads from the last location from surrounding loops.` addXIntersectionIndexes(loop, solidIndex, xIntersectionIndexList, y) `Add the x intersections for a loop.` addXIntersectionIndexesFromLoopLists(loopLists, xIntersectionIndexList, y) `Add the x intersections for the loop lists.` addXIntersectionIndexesFromLoops(loops, solidIndex, xIntersectionIndexList, y) `Add the x intersections for the loops.` compareSegmentLength(endpoint, otherEndpoint) `Get comparison in order to sort endpoints in ascending order of segment length.` getAngleAroundZAxisDifference(subtractFromVec3, subtractVec3) `Get the angle around the Z axis difference between a pair of Vector3s. Keyword arguments: subtractFromVec3 -- Vector3 whose angle will be subtracted from subtractVec3 -- Vector3 whose angle will be subtracted` getAroundLoop(begin, end, loop) `Get an arc around a loop.` getAwayPoints(pointComplexes, radius) `Get a path with only the points that are far enough away from each other.` getBackOfLoops(loops) `Get the back of the loops.` getClippedAtEndLoopPath(clip, loopPath) `Get a clipped loop path.` getClippedLoopPath(clip, loopPath) `Get a clipped loop path.` getCrossProduct(firstComplex, secondComplex) `Get z component cross product of a pair of complexes.` getDistanceToPlaneSegment(segmentBegin, segmentEnd, point) `Get the distance squared from a point to the x & y components of a segment.` getDotProduct(firstComplex, secondComplex) `Get the dot product of a pair of complexes.` getDotProductPlusOne(firstComplex, secondComplex) `Get the dot product plus one of the x and y components of a pair of Vector3s.` getFillOfSurroundings(surroundingLoops) `Get extra fill loops of surrounding loops.` getFloatPart(number) `Get the float part of the number.` getFrontOfLoops(loops) `Get the front of the loops.` getHalfSimplifiedLoop(loopComplex, radius, remainder) `Get the loop with half of the points inside the channel removed.` getHalfSimplifiedPath(path, radius, remainder) `Get the path with half of the points inside the channel removed.` getInsidesAddToOutsides(loops, outsides) `Add loops to either the insides or outsides.` getIntermediateLocation(alongWay, begin, end) `Get the intermediate location between begin and end.` getLargestLoop(loops) `Get largest loop from loops.` getLeftPoint(pointComplexes) `Get the leftmost complex point in the points.` getLoopStartingNearest(extrusionHalfWidth, location, loop) `Add to threads from the last location from loop.` getMaximum(firstComplex, secondComplex) `Get a complex with each component the maximum of the respective components of a pair of complexes.` getMaximumFromPoints(pointComplexes) `Get a complex with each component the maximum of the respective components of a list of complex points.` getMaximumSpan(loop) `Get the maximum span of the loop.` getMinimum(firstComplex, secondComplex) `Get a complex with each component the minimum of the respective components of a pair of complexes.` getMinimumFromPoints(pointComplexes) `Get a complex with each component the minimum of the respective components of a list of complex points.` getMinimumFromVec3List(vec3List) `Get a complex with each component the minimum of the respective components of a list of Vector3s.` getNearestDistanceIndex(point, loop) `Get the distance squared to the nearest segment of the loop and index of that segment.` getNearestPointOnSegment(segmentBegin, segmentEnd, point) `Get the nearest point on the segment.` getNormalized(complexNumber) `Get the normalized complex.` getNumberOfIntersectionsToLeft(leftPointComplex, loopComplex) `Get the number of intersections through the loop for the line starting from the left point and going left.` getOrderedSurroundingLoops(extrusionWidth, surroundingLoops) `Get ordered surrounding loops from surrounding loops.` getPathLength(path) `Get the length of a path ( an open polyline ).` getPathsFromEndpoints(endpoints, fillInset, pixelTable, width) `Get paths from endpoints.` getPlaneDot(vec3First, vec3Second) `Get the dot product of the x and y components of a pair of Vector3s.` getPointMaximum(firstPoint, secondPoint) `Get a point with each component the maximum of the respective components of a pair of Vector3s.` getPointMinimum(firstPoint, secondPoint) `Get a point with each component the minimum of the respective components of a pair of Vector3s.` getPointPlusSegmentWithLength(length, point, segment) `Get point plus a segment scaled to a given length.` getPointsRoundZAxis(planeAngle, points) `Get points rotated by the plane angle` getPolar(angle, radius=1.0) `Get polar complex from counterclockwise angle from 1, 0 and radius.` getPolygonArea(polygonComplex) `Get the area of a complex polygon.` getPolygonLength(polygon) `Get the length of a polygon perimeter.` getReverseFloatPart(number) `Get the reverse float part of the number.` getRotatedWiddershinsQuarterAroundZAxis(vector3) `Get Vector3 rotated a quarter widdershins turn around Z axis.` getRoundZAxisByPlaneAngle(planeAngle, vector3) `Get Vector3 rotated by a plane angle. Keyword arguments: planeAngle - plane angle of the rotation vector3 - Vector3 whose rotation will be returned` getRoundedPoint(point) `Get point with each component rounded.` getRoundedToDecimalPlaces(decimalPlaces, number) `Get number rounded to a number of decimal places.` getRoundedToDecimalPlacesString(decimalPlaces, number) `Get number rounded to a number of decimal places as a string.` getRoundedToThreePlaces(number) `Get number rounded to three places as a string.` getSegmentFromPoints(begin, end) `Get endpoint segment from a pair of points.` getSegmentsFromXIntersectionIndexes(xIntersectionIndexList, y) `Get endpoint segments from the x intersection indexes.` getSegmentsFromXIntersections(xIntersections, y) `Get endpoint segments from the x intersections.` getSimplifiedLoop(loopComplex, radius) `Get loop with points inside the channel removed.` getSimplifiedPath(path, radius) `Get path with points inside the channel removed.` getSquareValues(pixelTable, x, y) `Get a list of the values in a square around the x and y pixel coordinates.` getStepKey(x, y) `Get step key for x and y.` getTransferClosestSurroundingLoop(oldOrderedLocation, remainingSurroundingLoops, skein) `Get and transfer the closest remaining surrounding loop.` getTransferredPaths(insides, loop) `Get transferred paths from inside paths.` getTransferredSurroundingLoops(insides, loop) `Get transferred paths from inside surrounding loops.` getWiddershinsDotGiven(complexFirst, complexSecond) `Get the magintude of the positive dot product plus one of the x and y components of a pair of complexes, with the reversed sign of the cross product.` getXIntersection(firstComplex, secondComplex, y) `Get where the line crosses y.` getXIntersectionsFromIntersections(xIntersectionIndexList) `Get x intersections from the x intersection index list, in other words subtract non negative intersections from negatives.` getXYComplexFromVector3(vector3) `Get an xy complex from a vector3 if it exists, otherwise return None.` getZComponentCrossProduct(vec3First, vec3Second) `Get z component cross product of a pair of Vector3s.` isCloseXYPlane(overlapDistance, pixelTable, pointComplex, x, y) `Determine if the point is close to another point on the loop.` isInsideOtherLoops(loopIndex, loops) `Determine if a loop in a list is inside another loop in that list.` isLargeSameDirection(inset, loop, requiredSize) `Determine if the inset is in the same direction as the loop and if the inset is as large as the required size.` isLineIntersectingInsideXSegment(segmentFirstX, segmentSecondX, vector3First, vector3Second, y) `Determine if the line is crossing inside the x segment.` isLineIntersectingLoops(loops, pointBegin, pointEnd) `Determine if the line is intersecting loops.` isLoopIntersectingInsideXSegment(loop, segmentFirstX, segmentSecondX, segmentYMirror, y) `Determine if the loop is intersecting inside the x segment.` isLoopIntersectingLoops(loop, otherLoops) `Determine if the loop is intersecting other loops.` isLoopListIntersectingInsideXSegment(loopList, segmentFirstX, segmentSecondX, segmentYMirror, y) `Determine if the loop list is crossing inside the x segment.` isPathInsideLoop(loop, path) `Determine if a path is inside another loop.` isPathInsideLoops(loops, path) `Determine if a path is inside another loop in a list.` isPixelTableIntersecting(bigTable, littleTable, maskTable={}) `Add path to the pixel table.` isPointInsideLoop(loop, point) `Determine if a point is inside another loop.` isPointInsideLoops(loops, point) `Determine if a point is inside a loop list.` isSegmentCompletelyInX(segment, xFirst, xSecond) `Determine if the segment overlaps within x.` isWiddershins(polygonComplex) `Determine if the complex polygon goes round in the widdershins direction.` isWithinChannel(channelRadius, pointIndex, loopComplex) `Determine if the the point is within the channel between two adjacent points.` isXSegmentIntersectingPaths(paths, segmentFirstX, segmentSecondX, segmentYMirror, y) `Determine if a path list is crossing inside the x segment.` removePixelTableFromPixelTable(pixelTableToBeRemoved, pixelTableToBeRemovedFrom) `Remove pixel from the pixel table.` toggleHashtable(hashtable, key, value) `Toggle a hashtable between having and not having a key.` transferClosestFillLoop(extrusionHalfWidth, oldOrderedLocation, remainingFillLoops, skein) `Transfer the closest remaining fill loop.` transferClosestPath(oldOrderedLocation, remainingPaths, skein) `Transfer the closest remaining path.` transferClosestPaths(oldOrderedLocation, remainingPaths, skein) `Transfer the closest remaining paths.` transferPathsToSurroundingLoops(paths, surroundingLoops) `Transfer paths to surrounding loops.`

Data
`` |  | __author__ = 'Enrique Perez (perez_enrique@yahoo.com)' __date__ = '$Date: 2008/21/04 $' __license__ = 'GPL 3.0' absolute_import = _Feature((2, 5, 0, 'alpha', 1), (2, 7, 0, 'alpha', 0), 16384)

Author
`` |  | Enrique Perez (perez_enrique@yahoo.com)