triangleSdf2d

triangleSdf2d

sdf2d
triangleSdf2d
RayTK
v0.36

SDF for a 2D triangle.

Parameters

  • Shape: Which type of triangle to produce. The types are defined by different sets of parameters.
    • Equilateral Triangle: An equilateral triangle (all sides are the same). This is defined based on `Radius`. The triangle is centered around the origin.
    • Isosceles Triangle: An iscosceles triangle (2 sides are the same). This is defined based on `Width` and `Height`. The tip of the triangle is placed at the origin.
    • Inverted Isosceles Triangle:
    • Abritrary Triangle: An arbitrary triangle based on 3 points.
  • Radius: The distance from the center to each corner of the triangle. Used for equilateral triangles.
  • Height: The distance from the base of an iscosceles triangle to the opposite tip.
  • Width: The width of the base of an isosceles triangle.
  • Point 1: The first corner position, for an arbitrary triangle.
  • Point 2: The second corner position, for an arbitrary triangle.
  • Point 3: The third corner position, for an arbitrary triangle.
  • Direction:
    • Right (X+):
    • Left (X-):
    • Up (Y+):
    • Down (Y-):

Inputs

  • Radius Field: (optional)
    • Coordinate Types: vec2
    • Context Types: Context MaterialContext CameraContext LightContext RayContext ParticleContext
    • Return Types: float
  • Height/Width Field: (optional)
    • Coordinate Types: vec2
    • Context Types: Context MaterialContext CameraContext LightContext RayContext ParticleContext
    • Return Types: float