Package rope.mesh

Class R_Line2D

All Implemented Interfaces:
R_Constants, R_Constants_Colour
Direct Known Subclasses:
R_Puppet2D

public class R_Line2D extends R_Graphic
  • Constructor Details

    • R_Line2D

      public R_Line2D(processing.core.PApplet pa)
      Parameters:
      pa -
    • R_Line2D

      public R_Line2D(processing.core.PApplet pa, vec2 a, vec2 b)
      Parameters:
      pa -
      a -
      b -
    • R_Line2D

      public R_Line2D(processing.core.PApplet pa, float ax, float ay, float bx, float by)
      Parameters:
      pa -
      ax -
      ay -
      bx -
      by -
  • Method Details

    • set

      public R_Line2D set(vec2 a, vec2 b)
      use for definitive changement
      Parameters:
      a -
      b -
    • set

      public R_Line2D set(R_Line2D line)
      use for definitive changement
      Parameters:
      line -
      Returns:
    • set

      public R_Line2D set(float ax, float ay, float bx, float by)
      use for definitive changement
      Parameters:
      ax -
      ay -
      bx -
      by -
    • set_a

      public void set_a(float x, float y)
      use for definitive changement
      Parameters:
      x -
      y -
    • set_a

      public void set_a(vec2 a)
      use for definitive changement
      Parameters:
      a -
    • set_b

      public void set_b(float x, float y)
      use for definitive changement
      Parameters:
      x -
      y -
    • set_b

      public void set_b(vec2 b)
      use for definitive changement
      Parameters:
      b -
    • a

      public vec2 a()
      Returns:
      the final value for a
    • a

      public void a(vec2 a)
      use for temporary change
      Parameters:
      a -
    • a

      public void a(float x, float y)
      use for temporary change
      Parameters:
      x -
      y -
    • b

      public vec2 b()
      Returns:
      the final value for b
    • b

      public void b(vec2 b)
      use for temporary change
      Parameters:
      b -
    • b

      public void b(float x, float y)
      use for temporary change
      Parameters:
      x -
      y -
    • pointer

      public R_Line2D pointer(vec3 pointer_a, vec3 pointer_b)
      This function must be use with precaution because that's can break few function of the class like : offset(), change()... because the reference and the main point point on the same address So use in very specific cases.
      Parameters:
      pointer_a - give the same memory adress of the vec for the reference and the mane point
      pointer_b - give the same memory adress of the vec for the reference and the mane point
      Returns:
    • pointer_a

      public vec3 pointer_a()
      use with precaution because the vec who is returned pointer on real address in the memory so any modification can modify all value who ppoint on this one
      Returns:
      the final value for "a" and the original coord in the memory
    • pointer_a

      public void pointer_a(vec3 pointer_a)
      This function must be use with precaution because that's can break few function of the class like : offset(), change()... because the reference and the main point point on the same address So use in very specific cases.
      Parameters:
      pointer_a -
    • pointer_b

      public vec3 pointer_b()
      use with precaution because the vec who is returned pointer on real address in the memory so any modification can modify all value who ppoint on this one
      Returns:
      the final value for "b" and the original coord in the memory
    • pointer_b

      public void pointer_b(vec3 pointer_b)
      This function must be use with precaution because that's can break few function of the class like : offset(), change()... because the reference and the main point point on the same address So use in very specific cases.
      Parameters:
      pointer_b -
    • offset

      public R_Line2D offset(vec2 offset)
      make a displacement of the line
      Parameters:
      offset -
      Returns:
    • offset

      public R_Line2D offset(float offset_x, float offset_y)
    • reset

      public void reset()
      If you don't use show() function for any reason, and in parralelele you change point with function offset(), function change() or any futur method yo must use function reset() to come back to references points setting
    • get_point

      public vec2 get_point(float normal_abscissa)
      projected point on the line, the distance is calculated by multiplication the distance line by the normal argument where the starting point is the first point.
      Parameters:
      normal_abscissa - where 0 is the starting point and 1 is the end point
      Returns:
      a coordinate of the point
    • get_point

      public vec2 get_point(float normal_abscissa, float normal_ordinate)
      Parameters:
      normal_abscissa -
      normal_ordinate -
      Returns:
    • get_point

      public vec2 get_point(int len_abscissa)
      Parameters:
      len_abscissa - the position on the line can be upper or lower or the segment
      Returns:
      a coordinate of the point
    • get_point

      public vec2 get_point(int len_abscissa, int len_ordinate)
      Parameters:
      len_abscissa -
      len_ordinate -
      Returns:
    • angle

      public float angle()
      Return the angle of the line from "a" to "b"
      Returns:
    • angle

      public float angle(R_Line2D line)
    • ortho

      public vec2 ortho(vec2 p)
      return the projection of the point on the line
      Parameters:
      p - is point must projected on the line
      Returns:
    • normal

      public Float normal(vec2 p, float marge)
      Check if a vec point is on the line, if it's true return ne normal position on it '0' to '1' where '0' represent a and 'b' for '1'. if the point is not on the segment the value return NaN.
      Parameters:
      p - coordinate of the point must be checked
      marge - range in pixel around the point must be checked
      Returns:
    • normal

      public Float normal(vec2 vec)
      Parameters:
      vec -
      Returns:
      See Also:
    • id

      public R_Line2D id(int a, int b, int c, int d, int e, int f)
    • id

      public R_Line2D id(ivec6 id)
    • id

      public R_Line2D id(int id)
    • id_a

      public R_Line2D id_a(int id)
    • id_b

      public R_Line2D id_b(int id)
    • id_c

      public R_Line2D id_c(int id)
    • id_d

      public R_Line2D id_d(int id)
    • id_e

      public R_Line2D id_e(int id)
    • id_f

      public R_Line2D id_f(int id)
    • id

      public ivec6 id()
    • mute

      public R_Line2D mute(boolean is)
      change the state of the line, can be helpful to show or not the line and set behavior
      Parameters:
      is -
      Returns:
    • mute_is

      public boolean mute_is()
    • change

      public R_Line2D change(float begin, float end)
      the idea is pass a normal value 0 to 1, where 1 is the size of your segment. The size is mult by the value
      Parameters:
      begin - add the distance of the beginning of the segment, where the value is a normal value.
      end - add the distance of the end of the segment, where the value is a normal value.
    • rotation

      public R_Line2D rotation(float angle)
      Change the angle from the starting point "a"
      Parameters:
      angle -
      Returns:
      himself
    • rotation

      public R_Line2D rotation(float angle, float normal_pos)
      Create a rotation angle with the axe. The axe is calculated with a normal position where 0 is the start point and 1 the end point see point()
      Parameters:
      angle - in radian
      normal_pos -
      Returns:
      himself
    • mode_abscissa

      public void mode_abscissa(int type)
      Parameters:
      type - value to set the random on abscissa NORMAL, START, END, CENTER and SIDE is available
    • mode_abscissa

      public void mode_abscissa(int type, int level)
      Parameters:
      type - value to set the random on abscissa NORMAL, START, END, CENTER and SIDE is available
      level - from 1 to 13, but for CENTER and SIDE after 6 or 7 is not really interesting
    • mode_ordinate

      public void mode_ordinate(int type)
      Parameters:
      type - value to set the random on abscissa NORMAL, START, END, CENTER and SIDE is available
    • mode_ordinate

      public void mode_ordinate(int type, int level)
      Parameters:
      type - value to set the random on abscissa NORMAL, START, END, CENTER and SIDE is available
      level - from 1 to 13, but for CENTER and SIDE after 6 or 7 is not really interesting
    • set_pixels

      public void set_pixels(float density)
      Parameters:
      density - the ratio abscissa of pixels along the line from 0 to 1 usualy
    • set_pixels

      public void set_pixels(float density, float thickness)
      Parameters:
      density - the ratio abscissa of pixels along the line from 0 to 1
      thickness - is the strokeWeight / ordinate of your line in pixel point
    • set_pixels

      public void set_pixels(float density, float thickness, R_Colour palette)
      Parameters:
      density - the ratio abscissa of pixels along the line from 0 to 1
      thickness - is the strokeWeight / ordinate of your line in pixel point
      colour - list of int color to create the pixel line
    • set_palette

      public void set_palette(int... colours)
    • growth_option

      public void growth_option(boolean field_is, int type, boolean use_gradient)
      The direction is based on start_fov angle
      Parameters:
      type - of pixel growth distribution
      use_gradient - to create a gradient from the fist color to second... il there more color in the palette the color is used like a pair colors successively
      use_field - to distribute the pixels only in the fov field
    • growth_option

      public void growth_option(boolean field_is, int type)
    • get_growth_type

      public int get_growth_type()
    • growth

      public void growth(int level, int step)
    • growth

      public void growth(int level, int step, float direction, float fov)
      The direction is based on the bissector of the fov
      Parameters:
      level - from 1 to n
      step - from 1 to n
      direction - from 0 to 2PI / TAU
      fov - from 0 to 2PI / TAU
    • growth

      public void growth(int level, int step, float direction, float start_fov, float end_fov)
      The direction is based on start_fov angle
      Parameters:
      level - from 1 to n
      step - from 1 to n
      direction - from 0 to 2PI / TAU
      start_fov - from 0 to PI
      end_fov - from 0 to PI
    • get_field

      public R_Shape get_field(float direction, float start_angle, float end_angle, float dist)
      Can be useful to create a field action from the line. this function is use internally for the pixel growth.
      Parameters:
      direction - of the field
      start_angle - from the point a
      end_angle - from the point b
      dist - distance of the field from the line
      Returns:
      R_Shape
    • get_pixies

      public R_Pix[] get_pixies()
      Returns:
      the array of pixels a long the line if it's possible.
    • get_pixies_growth

      public R_Pix[] get_pixies_growth()
    • pixels_is

      public boolean pixels_is()
    • show

      public void show()
      Show the result of all previous work on line
    • show_pixels

      public void show_pixels()
    • show_pixels_x2

      public void show_pixels_x2()
    • show_pixels

      public void show_pixels(float density)
    • show_pixels

      public void show_pixels(float density, float thickness)
      Parameters:
      density -
      thickness -
      palette -
    • show_pixels_x2

      public void show_pixels_x2(float density)
      Parameters:
      density -
      colour -
    • show_pixels_x2

      public void show_pixels_x2(float density, float thickness)
      Parameters:
      density -
      thickness -
      colour -
    • barycenter

      public vec2 barycenter()
      Returns:
      the barycenter of the two points
    • dist

      public float dist()
      Return the length of the line
      Returns:
    • intersection

      public vec2 intersection(R_Line2D target)
      Return the intersection point between this line and an other one.
      Parameters:
      target -
      Returns:
    • intersection

      public vec2 intersection(R_Line2D target, vec2... exception)
      Return the intersection point between this line and an other one.
      Parameters:
      target -
      exception - , list of vec2 point make an exception node, helpful when you don't want a specific node point
      Returns:
    • copy

      public R_Line2D copy()
      Returns:
      copy of herself
    • toString

      public String toString()
      Overrides:
      toString in class Object