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 implements R_Constants
  • 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)
      Parameters:
      a -
      b -
    • set

      public R_Line2D set(R_Line2D line)
      Parameters:
      line -
      Returns:
    • set

      public R_Line2D set(float ax, float ay, float bx, float by)
      Parameters:
      ax -
      ay -
      bx -
      by -
    • 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:
    • 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 -
    • 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 -
    • 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:
      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_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 -
    • 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:
      x -
      y -
    • 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
    • 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:
    • point

      public vec2 point(float normal_pos)
      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_pos - where 0 is the starting point and 1 is the end point
      Returns:
      a coordinate of the point
    • point

      public vec2 point(int len)
      Parameters:
      len - the position on the line can be upper or lower or the segment
      Returns:
      a coordinate of the point
    • 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:
      marge - range in pixel around the point must be checked
      point - coordinate of the point must be checked
      Returns:
    • normal

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

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

      @Deprecated public vec2 coord(float normal_pos)
      Deprecated.
      instead use vec2 point(float normal_pos)
      return coordinate of the normal position on the line from the first point the distance use is calculte with the length of the line.
      Parameters:
      normal_pos - is the normal distance from the first point
      Returns:
    • coord

      @Deprecated public vec2 coord(int len)
      Deprecated.
      instead use vec2 point(int len)
      return coordinate of distance from the first point of the line
      Parameters:
      len - is the distance from the first point
      Returns:
    • 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
    • angle

      @Deprecated public R_Line2D angle(float angle)
      Deprecated.
    • angle

      @Deprecated public R_Line2D angle(float angle, float normal_pos)
      Deprecated.
    • set_pixels

      public void set_pixels(float density, int... colour)
    • get_pixels

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

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

      @Deprecated public void show(processing.core.PGraphics other)
      Deprecated.
      Show the result of all previous work on line
      Parameters:
      other - is the PGraphics where the result will be showing
    • show_pixels

      public void show_pixels()
    • show_pixels_x2

      public void show_pixels_x2()
    • show_pixels

      public void show_pixels(float density, int... colour)
    • show_pixels_x2

      public void show_pixels_x2(float density, int... 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:
    • toString

      public String toString()
      Overrides:
      toString in class Object