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¶
Code to write AutoCAD scripts.
- 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)¶
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¶
Simple utilities to draw longitudinal sections.
- 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¶
- 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¶
Parabola class.
- class geom_utils.parabola.Parabola(p0, p1, p2)¶
Bases:
object
- Variables
a – x^2 factor.
b – x factor.
c – constant.
- alpha(x)¶
Return the angle of the tangent for x.
- curvature(x)¶
Return the value of the curvature for x.
- from3Points(p0, p1, p2)¶
Parabola through three points
- y(x)¶
Return the ordinate value for x.
- yP(x)¶
Return the first derivative value for x.
- yPP(x)¶
Return the second derivative value for x.
- geom_utils.parabola.eq_points_parabola(startS, stopS, numPts, a, b, c, angSX)¶
Returns equispaced nPts points of the parabola “z=as^2 + bs + c” in the range [startS,stopS]. S is a coordinate by the straight line projection of the parabola on the XY plane. angSX is the angle (in rad) between that line and the X-axis
- geom_utils.parabola.fit_parabola(x, y)¶
Fits the equation “y = ax^2 + bx + c” given exactly 3 points as two lists or arrays of x & y coordinates
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)¶
Ax+By+Cz+D= 0
- geom_utils.regression_plane.plane(x, y, params)¶
Section by folding planes¶
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)¶