Add spatial points to tikzpy object (points object)

Load main tikzpy class as follow and create and edit spatial points:

 1### Load tikzpy library
 2import tikzpy
 3
 4### Load main object
 5tikZ = tikzpy.pytikz()
 6# or
 7tikZ = tikzpy.load()
 8
 9### Add point at x=0, y=0, z=0
10p1 = tikZ.pto.pto(0.1,0.2,0.3, layer=0, alias='pto1')
11
12### Add point at x=1, y=1, z=1
13p2 = tikZ.pto.pto(1,1,1, layer=0, alias='pto2')
14
15### Vector between point 1 and 2
16vec = p2 - p1
17
18### Access point variables
19x, y, z = p1.x, p1.y, p1.z

and start bulding your drawing.

More examples on how to use the points object can be found in points examples.

Points functions. Class -> tikzpy.pto

class cls_points._points(parent)[source]

Points class:

Platform

Unix, Windows

Synopsis

Allows to add, operate and edit points in a 3D space

Properties
  • Get a point by unique id. (pto = tikzpy.pto[id])

  • Set a point by unique id. (tikzpy.pto[id]=pto). When set just the coordinates are changed.

  • Iterate points as point object

Chracteristics of a point (pto) object

Variables
  • id – get unique id of the point

  • alias – set/get alias name of the point

  • x – set/get x coordinate property

  • y – set/get y coordinate property

  • z – set/get z coordinate property

  • xyz – set/get the three coordinates

  • layer – set/get layer member property

  • info – get formated text with point info

Operations
  • equality (pto1 == pto2): check the three coordinates are the same

  • sum (pto1 + pto2): allow to sum to points as it were two vectors

  • sum (pto1 + real): sum to all the coordinates the real number

  • diff (pto1 - pto2): allow to subtracts to points as it were two vectors

  • diff (pto1 - real): substract to all the coordinates the real number

  • multiplication (pto1 * pto2): multiplicate each coordinate by the other

  • multiplication (pto1 * real): multiplicate each coordinate by the real number

  • print (print pto1): prints the point info

  • copy (pto3 = pto1.copy(alias)): deepcopy of a point (diferent unique id)

pto(x=0, y=0, z=0, layer=0, alias='')[source]
Synopsis:
  • Add a new point

Args:
  • x=0: x coordinate

  • y=0: y coordinate

  • z=0: z coordinate

  • layer = 0: layer member

  • alias = “”: alias name

Returns:
  • A point object with the x, y, z, layer and name properties

Note

  • See example

aux(x=0, y=0, z=0, layer=0)[source]
Synopsis:
  • Add an new auxiliary point

Args:
  • x=0: x coordinate

  • y=0: y coordinate

  • z=0: z coordinate

  • layer = 0: layer member

Returns:
  • A point object with the x, y, z, layer and name properties

Note

  • Auxiliary points do not have unique id

  • Atribute .save() asign a unique id to an auxiliary point

alias(alias)[source]
Synopsis:
  • Return a point by alias

Args:
  • alias: point alias

Returns:
  • The first point object with such alias

Note

  • Alias can be empty or be a unique identification. Can not start with a # character.

translate(ptos, x=0.0, y=0.0, z=0.0)[source]
Synopsis:
  • Translate a point of list of points in a 3D space

Args:
  • ptos: multiple points. Can be set as a point, a list o points, an alias or a list of alias. See addpto examples

Optional parameters:
  • x = 0: increment in x coordinate to tranlate

  • y = 0: increment in y coordinate to tranlate

  • z = 0: increment in z coordinate to tranlate

Returns:
  • None

Note

translate_to(ptos, pto_ref, pto_ref_final)[source]
Synopsis:
  • Given a reference point and a final position for such point. Translate a point or list of points in a 3D space in a similar manner.

Args:
  • ptos: multiple points. Can be set as a point, a list o points, an alias or a list of alias. See addpto examples

Optional parameters:
  • pto_ref: reference point

  • pto_ref_final: final refence point position

Returns:
  • None

Note

rotate(ptos, pto_rotation, Ax=0.0, Ay=0.0, Az=0.0)[source]
Synopsis:
  • Rotate a point or list of points in a 3D space respect an origin point

Args:
  • ptos: multiple points. Can be set as a point, a list o points, an alias or a list of alias. See addpto examples

  • pto_rotation: center point of rotation

Optional parameters:
  • Ax = 0.: yaw angle in degrees to turn respect axis X

  • Ay = 0.: pitch angle in degrees to turn respect axis Y

  • Az = 0.: roll angle in degrees to turn respect axis Z

Returns:
  • None

Note

scale(ptos, Sx=1.0, Sy=1.0, Sz=1.0, pto_origin=None)[source]
Synopsis:
  • Scale a point or list of points in a 3D space respect an origin point

Args:
  • ptos: multiple points. Can be set as a point, a list o points, an alias or a list of alias. See addpto examples

Optional parameters:
  • Sx = 1.: scale in axis X

  • Sy = 1.: scale in axis Y

  • Sz = 1.: scale in axis Z

  • pto_origin = None: center point of scaling, if None origin is global origin

Returns:
  • None

Note

copy(ptos, alias_prefix='', alias_sufix='')[source]
Synopsis:
  • Returns a copy of the list of points

Args:
  • ptos: multiple points. Can be set as a point, a list o points, an alias or a list of alias. See addpto examples

Optional parameters:
  • alias_sufix = “”: Add a sufix to the alias of each point

  • alias_prefix = “”: Add a prefix to the alias of each point

Returns:
  • List of points copied (ids), with the alias modified

Note

  • If alias_sufix and alias_prefix is “”, an empty alias for each copied point is return

  • See addpto examples

  • See example 3

draw_points(ptos=None, mark_radius=1, color='', label='#marker_points', layer=-1e-10)[source]
Synopsis:
  • Draw a list of points with a marker

  • If no list of points is given, all the points are draw with a marker

Args:
  • ptos = None: multiple points. Can be set as a point, a list o points, an alias or a list of alias. See addpto examples

Optional parameters:
  • mark_radius = 1: scale of marker size

  • color = “”: color of the marker

  • label = “#marker_points”: label added to the markers

  • layer = -1e-10: layer were the markers belong

Returns:
  • None

Note

read_list_csv(file_path, delimiter=None)[source]
Synopsis:
  • Read list of points in csv file

  • Rows layout: x, y, z, alias, layer

Args:
  • file_path: Full path to csv file.

Optional parameters:
  • delimiter = None: columns separator

Returns:
  • List of points ids ptos

Note

ptos(x, y, z=None, layer=None, alias='')[source]
Synopsis:
  • Returns a list of points build with the x, y, z coordinates 1D arrays

Args:
  • x: 1D array or list, coordinate x

  • y: 1D array or list, coordinate y

Optional parameters:
  • z = None: 1D array or list, coordinate z. If None, fills z coordinate with 0, else with the number or with a given list.

  • layer = None: 1D array or list, layers. If None, fills layer with 0, else with the number or with a given list.

  • alias = ‘’: 1D array or list, alias. If None, fills alias with ‘’, else with a given list (all alias must be different if not ‘’).

Returns:
  • List of points ids ptos

Note

  • All 1D array or list should be of the same size

  • None

middle_point(p1, p2, layer=0, alias='')[source]
Synopsis:
  • Return a middle point between p1 and p2

Args:
  • pto1: point one

  • pto2: point two

Optional parameters:
  • layer = 0: layer member new point

  • alias = “”: alias name new point

Returns:
  • Point at the middle distance

Note

  • None

ptos_distance(p1, p2)[source]
Synopsis:
  • Distance between p1 and p2

Args:
  • pto1: point one

  • pto2: point two

Optional parameters:
  • None

Returns:
  • Distance between two points

Note

  • None