genepy3d_gpl.obj package#

Module contents#

Submodules#

genepy3d_gpl.obj.curves module#

Methods for working with Curve objects.

Functions:

intersect(c1, c2)

Intersection between two curves.

genepy3d_gpl.obj.curves.intersect(c1, c2)[source]#

Intersection between two curves.

Parameters:
  • c1 (Curve) – curve object.

  • c2 (Curve) – curve object.

Returns:

list of intersected points.

Examples

import numpy as np
from genepy3d.obj.curves import Curve
from genepy3d_gpl.obj import curves
import matplotlib.pyplot as plt

# Create two dummy curves
crv1 = Curve(([0.,1.,2.],[0.,1.,2.],[0.,0.,0.]))
crv2 = Curve(([1.5,1.5,1.5],[0.,1.,2.],[0.,0.,0.]))

# Check intersection
pnts = curves.intersect(crv1,crv2)

# Plot curves and intersected points
fig = plt.figure()
ax = fig.add_subplot(111,projection='3d')
crv1.plot(ax,show_root=False);
crv2.plot(ax,show_root=False);
pnts.plot(ax);

genepy3d_gpl.obj.points module#

Methods for working with Points objects.

Functions:

to_Point_3_CGAL(pnts)

Return the Points object as a list of Point_3 objects in CGAL.

to_Point_set_3_CGAL(pnts)

Convert Points object to Point_set_3 object in CGAL.

process(pnts[, removed_percentage, ...])

Process the points cloud by outlier removal and smoothing.

genepy3d_gpl.obj.points.to_Point_3_CGAL(pnts)[source]#

Return the Points object as a list of Point_3 objects in CGAL.

Parameters:

pnts (Points) – Points object.

Returns:

A list of CGAL.Point_3 objects.

genepy3d_gpl.obj.points.to_Point_set_3_CGAL(pnts)[source]#

Convert Points object to Point_set_3 object in CGAL.

Parameters:

pnts (Points) – Points object.

Returns:

Point_set_3 object in CGAL.

genepy3d_gpl.obj.points.process(pnts, removed_percentage=5.0, nb_neighbors=24, smooth=True)[source]#

Process the points cloud by outlier removal and smoothing.

Details can be see here [1].

Parameters:
  • pnts (Points) – Points object.

  • removed_percentage (float) – % of outlier removal.

  • nb_neighbors (int) – number of neighboring points used in outlier removal and smoothing algorithms.

  • smooth (bool) – if True, then smooth the points cloud.

Returns:

A processed Points object.

References

Examples

import numpy as np
from sklearn.datasets import make_blobs
from genepy3d.obj.points import Points
from genepy3d_gpl.obj import points
import matplotlib.pyplot as plt

# Generate random 3D points
coors, _ = make_blobs(n_features=3, centers = [(0, 0, 0)], n_samples=500, cluster_std=3.)
pnts = Points(coors)

# Remove outliers (20% of points)
pnts_processed = points.process(pnts,removed_percentage=20,smooth=False)

# Plot
fig = plt.figure()
ax = fig.add_subplot(111,projection='3d')
pnts.plot(ax,point_args={'alpha':0.2})
pnts_processed.plot(ax,point_args={'color':"r",'s':3})

genepy3d_gpl.obj.surfaces module#

Methods for working with Surface objects.