POV-Ray : Newsgroups : povray.binaries.images : Curved sheet passing through 4 points : Curved sheet passing through 4 points Server Time
26 Apr 2024 19:34:14 EDT (-0400)
  Curved sheet passing through 4 points  
From: Bald Eagle
Date: 1 Jun 2019 20:50:01
Message: <web.5cf31c5f43128c364eec112d0@news.povray.org>
Re:
http://news.povray.org/povray.general/thread/%3Cweb.5cf316ed57960f354eec112d0%40news.povray.org%3E/


So here's the relevant section.
Little tidbits here are, the equation of a plane is Ax + By + Cz = D,
or Ax + By + Cz - D = 0.
So when you do plane {y, 0} what you're actually doing is
function {0x + 1y + 0z - 0}

I take the 3 points that will define one flat "arm" of the curved sheet and
derive the coefficients for the plane equation from the <x, y, z> coordinates.
The other plane is just a plane defined by a cardinal axis normal (but which
ought to be defined by a vector derive from the 4th point projected onto the
plane....   I'm getting there...

Multiplying the function by -1 gives the equivalent of adding the inverse
keyword.

then I just blob them together like in the documentation for isosurfaces with a
blob threshold of 0.3


  #declare Point1 = <3, 0.5, -1>;
  #declare Point2 = <1.5, -0.5, 0>;
  #declare Point3 = <1, 1, -1>;
  #declare Point4 = <-3, 0.125, 3,>;  /// odd point out
  #declare Z4 = Point4.x;

  // derive the plane equation
  #declare A1 = Point1.y*(Point2.z-Point3.z) + Point2.y*(Point3.z-Point1.z) +
  Point3.y*(Point1.z-Point2.z);

  #declare B1 = Point1.z*(Point2.x-Point3.x) + Point2.z*(Point3.x-Point1.x) +
  Point3.z*(Point1.x-Point2.x);

  #declare C1 = Point1.x*(Point2.y-Point3.y) + Point2.x*(Point3.y-Point1.y) +
  Point3.x*(Point1.y-Point2.y);

  #declare D1 = -1*(Point1.x*(Point2.y*Point3.z-Point3.y*Point2.z) +
  Point2.x*(Point3.y*Point1.z-Point1.y*Point3.z) +
  Point3.x*(Point1.y*Point2.z-Point2.y*Point1.z));

  #declare Blob_Threshold=0.3;

  #declare fn_A = function { -1*(A1*x + B1*y + C1*z - D1)}
  #declare fn_B = function { (x - Z4) }

  isosurface {
   function {
    (1+Blob_Threshold)
    -pow(Blob_Threshold, fn_A(x,y,z))
    -pow(Blob_Threshold, fn_B(x,y,z))
   }
   open
   max_gradient 10
   contained_by { box { -4, 4 } }
   texture {Tan} interior_texture {Gray}
  }

  /*isosurface {
   function {fn_A(x,y,z)}
   //open
   contained_by {box {-4, 4}}
     texture {Blue} interior_texture {Gray}
    }*/

  #declare Rad = Line;
  sphere {Point1 Rad texture {Red}}
  sphere {Point2 Rad texture {Red}}
  sphere {Point3 Rad texture {Red}}
  sphere {Point4 Rad texture {Blue}}


  /*intersection {
   plane {<A1, B1, C1>, D1 inverse}
   box {-4, 4 texture {pigment {rgbt 1}}}
   texture {Green}
   interior_texture {pigment {rgbt 1}}
  }*/

Not robust or optimized in any way, but it shows proof of concept.


Post a reply to this message


Attachments:
Download 'documentationfigures.png' (76 KB)

Preview of image 'documentationfigures.png'
documentationfigures.png


 

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.