Geometry utils

XY parametrized 3D polyline

class geom_utils.XY_parametrized_3Dpoly.XYParametrized3DPoly(points)

Bases: object

getLength()
getPoint(s)
getPointsAt(factors)
getPointsEveryXmetres(spacement)
getPos3d(s)
s = []
x(s)
xfn = None
y(s)
yfn = None
z(s)
zfn = None
geom_utils.XY_parametrized_3Dpoly.filterDuplicatePoints(points)

Acad script utils

geom_utils.acad_script_utils.comment(fScript, text)
geom_utils.acad_script_utils.coo2D(fScript, x, y)
geom_utils.acad_script_utils.coo3D(fScript, x, y, z)
geom_utils.acad_script_utils.currentLayer(fScript, layerName)
geom_utils.acad_script_utils.line2D(fScript, pA, pB)
geom_utils.acad_script_utils.makeLayer(fScript, layerName, colorName)
geom_utils.acad_script_utils.pline(fScript, pointsPline)
geom_utils.acad_script_utils.pline3D(fScript, pointsPline)
geom_utils.acad_script_utils.point(fScript, x, y, z)
geom_utils.acad_script_utils.save(fScript, fName)
geom_utils.acad_script_utils.snap(fScript, value)
geom_utils.acad_script_utils.text(fScript, x, y, just, size, angle, msg)
geom_utils.acad_script_utils.zoomExtents(fScript)

Cairo graphics

class geom_utils.aux_cairo_plot.ArrowCircle(lineColor, fillColor)

Bases: geom_utils.aux_cairo_plot.ArrowSolidBase

draw(ctx, start, end)
class geom_utils.aux_cairo_plot.ArrowDiamond(lineColor, fillColor)

Bases: geom_utils.aux_cairo_plot.ArrowSolidBase

draw(ctx, start, end)
class geom_utils.aux_cairo_plot.ArrowHead(style, lineColor)

Bases: object

calcVertices(start, end)
class geom_utils.aux_cairo_plot.ArrowOpen(lineColor)

Bases: geom_utils.aux_cairo_plot.ArrowHead

draw(ctx, start, end)
class geom_utils.aux_cairo_plot.ArrowSolid(lineColor, fillColor)

Bases: geom_utils.aux_cairo_plot.ArrowSolidBase

draw(ctx, start, end)
class geom_utils.aux_cairo_plot.ArrowSolidBase(lineColor, fillColor)

Bases: geom_utils.aux_cairo_plot.ArrowHead

class geom_utils.aux_cairo_plot.Boundary(xmin, ymin, xmax, ymax)

Bases: object

getXCenter()
getXWidth()
getYCenter()
getYWidth()
class geom_utils.aux_cairo_plot.TransformParams(w, h, bnd)

Bases: object

applyTransform(ctx)
plotPolygon(plg, ctx)

Draws polygon countour

plotYZAxis(ctx)

Draws Y and Z axis.

Interpolation

geom_utils.interpolation.interpEquidistPoints(xi, yi, nDiv)

Return the interpolated values of the function y=f(x) at equally spaced x coordinates. The function is defined by a list of ‘yi’ ordinate at abcissae ‘xi’

Parameters:
  • xi – list of abcissae.
  • yi – list of ordinate.
  • nDiv – number of divisions in segment xi[0] to xi[-1] where to obtain the abcisae to be interpolated.
geom_utils.interpolation.interpolateLine(x0, y0, x1, y1, x)

Return the value obtained interpolating with a line that passes through the points (x0,y0) y (x1,y1)

Longitudinal profile

class geom_utils.longitudinal_profile.GuitarString(name, xData, yData)

Bases: object

fmt = '{:.3f}'
getDifference(name, other, x)
getInterpolation1d()
getOffseted(name, offset)
getTexts(fScript, x)
name = 'nil'
x(i)
xData = []
y(i)
yData = []
class geom_utils.longitudinal_profile.LongProfile(x, nameY, y)

Bases: object

abscissaName = 'nil'
acadScript(scriptFileName, dwgFileName)
appendDummyLine(name, data)
appendDummyString(string)
appendOrdinatesLine(name, xData, yData)
appendOrdinatesString(gString)
dataLines = {}
getDifference(newName, nameA, nameB)
getEnvelope(x)
getInterpolatedValues(name, x)
getOrdinateInterpolation1d(name)
getPartials()
getTrfPoint(x, y)
getTrfPoints(y)
horizScale = 0.005
ordinateNames = []
plotOrdinates(fScript)
plotTexts(fScript)
plotVertLines(fScript)
rowOrder = []
setAbscissaLine(name, xData, yData)
textScale = 0.0025000000000000005
title = 'nil'
update(dl)
vertScale = 0.05
yMN = 1000000000.0
yMX = 0.0
zHorizon = 940
class geom_utils.longitudinal_profile.extrap1d(x, y)

Bases: object

check_x(x)
fn = None
geom_utils.longitudinal_profile.filterPointsFromPline3d(points, tol)
geom_utils.longitudinal_profile.getAbscissasFromPline3d(points)
geom_utils.longitudinal_profile.getAbscissasFromPoints2d(points2d)
geom_utils.longitudinal_profile.getDistXY(pA, pB)
geom_utils.longitudinal_profile.getDistXYZ(pA, pB)
geom_utils.longitudinal_profile.getGuitarStringFromPline3D(name, points)
geom_utils.longitudinal_profile.getLongXYPline3d(points, dist)
geom_utils.longitudinal_profile.getOrdinatesFromPline3d(points)
geom_utils.longitudinal_profile.getOrdinatesFromPoints2d(points2d)
geom_utils.longitudinal_profile.getPointsProfilAlongPline3d(points, spacement)
geom_utils.longitudinal_profile.getProfileFromPline3D(points, name, tol=0.0001)
geom_utils.longitudinal_profile.getProfileFromPline3DEveryXmetres(points, name, space)

Parabola

class geom_utils.parabola.Parabola(p0, p1, p2)

Bases: object

a = 0.0
alpha(x)
b = 0.0
c = 0.0
curvature(x)
from3Points(p0, p1, p2)

Parabola through three points

y(x)
yP(x)
yPP(x)

Principal axis

Computes principal axes of a point cloud. Original authors: “Pierre Poulain” , “Justine Guegan”, “Edithe Selwa”, “Steven C. Howell”

geom_utils.principal_axis.get_principal_axis_3D(points)

Compute principal axes

Parameters:points – 3D point cloud.

Projection

geom_utils.projection.projXYPline3d(xyzPline)

Regression plane

geom_utils.regression_plane.error(params, points)
geom_utils.regression_plane.getRegressionPlane(points)
geom_utils.regression_plane.plane(x, y, params)

Section by folding planes

class geom_utils.section_by_folding_planes.XYFoldingPlanes(xyPolyline)

Bases: object

getIntersectionWith3DLine(p0, p1)
getIntersectionWith3DSegment(segment3d)
xyPline = None

Section by plane

class geom_utils.section_by_plane.SectionByPlane(nm, p)

Bases: object

Intersection of a polyline or a list of polylines by a plane.

getIntersection(pline)

Returns the intersection of the polyline with the plane.

getIntersectionPoints(listOfPlines)

Returns the intersection of a list of polylines with the plane.

name = '-'
plane = point: x= 1,y= 0,z= 0 normal: [[0.57735][0.57735][0.57735]]

Surveying data

geom_utils.surveying_data.dist(p, points)
geom_utils.surveying_data.dist2XYZ(pA, pB)
geom_utils.surveying_data.distXYToPline(p, pline)
geom_utils.surveying_data.getNumberedPoints(points, firstNumber, step=1)
geom_utils.surveying_data.getPoints(plines, spacement, step=1)
geom_utils.surveying_data.getPointsAt(plines, factors, step=1)
geom_utils.surveying_data.writeAcadScripts(pointsPiquetage, pointsFileName, textFileName)