home > kero > Documentation

Given 2 points in the form (x,y,z), return a set of points that forms a line between these two points.

kero.multib.nDnet.py def edge_maker(point1,point2, no_of_points): return edge

**Arguments/Return**

point1 | 3-tuple, (x,y,z), Cartesian coordinates of the first vertex. |

point2 | 3-tuple, (x,y,z), Cartesian coordinates of the second vertex. |

no_of_points | Integer. The number of points created in a straight-line between point1 and point2. |

return edge | List of list, [p1, p2,…, pN] where N = no_of_points, each pk=[x,y,z], a point in the edge that forms the straight line between point1 and point2. The format of each point in the edge is in Cartesian coordinates as well. |

**Example Usage**

import kero.multib.nDnet as nd x=(1,2,3) y=(4,3,1) edge_set = nd.edge_maker(x,y, 10) for xx in edge_set: print(xx) import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111,projection='3d') X0 = [x[0],y[0]] Y0 = [x[1],y[1]] Z0 = [x[2],y[2]] ax.scatter(X0,Y0,Z0) X = [edge_set[i][0] for i in range(len(edge_set))] Y = [edge_set[i][1] for i in range(len(edge_set))] Z = [edge_set[i][2] for i in range(len(edge_set))] ax.scatter(X,Y,Z,s=10) plt.show()

Two points are plotted in blue below, and the points in the edge created by this function is in orange, where N is set to 10.

*kero version: 0.5.1 and above*