POV-Ray : Newsgroups : povray.newusers : Rounded Edges Question : Re: Rounded Edges Question Server Time
4 Nov 2024 17:36:26 EST (-0500)
  Re: Rounded Edges Question  
From:
Date: 23 Jun 2003 23:21:20
Message: <3ef7c3b0$1@news.povray.org>
//  Hi Bob,
//
//  the macro mentioned by Peter probably is mine.
//
//  Example picture:
//     povray.binaries.images, 23rd and 26th January 2003
//     "Round/bevel: include file demo [51 KB JPG]"
//  Include file and "slide show" demo:
//     povray.binaries.scene-files, 23rd January
//     "Round/bevel: Include file"
//  Tutorial:
//     same thread, 26th January
//     "Round/bevel: Mini-Tutorial; Test-Arena"
//
//  A heart is no problem, but the shape is sort of
//  "circular/linear spline", so it is incompatible with
//  bezier_spline. For a simple object like a heart this
//  is a bit overkill; what about this:



//=== macro for a heart ===============================================
//
// Round: radius of rounded corners, >0
// Thick: thickness, >2*Round

#macro Heart (Round, Thick)
  #local HalfHeart =
    intersection {
      merge {
        torus { 1-Round, Round translate        Round *y }
        torus { 1-Round, Round translate (Thick-Round)*y }
        cylinder { 0      ,  Thick       *y, 1-Round }
        cylinder { Round*y, (Thick-Round)*y, 1       }
        translate 0.5*y
        scale <1.7, 1, 1> // shape variations: replace 1.7 by 1 .. 2
        rotate -45*y      //                   replace -45 by 0 .. 70
        }
      plane { -x, 1E-5 }
      }

  merge {
    object { HalfHeart }
    object { HalfHeart scale <-1, 1, 1> }
    texture {
      pigment { color rgb <1, 0, 0> }
      finish { ambient .2 diffuse .6 specular .4 roughness 0.0005 }
      }
    // no "}" to allow appending modifiers

  #end//macro Heart


//=== example scene ===================================================

Heart ( .25, .6 ) translate <-0.3, 0, -0.7> }
Heart ( .05, .6 ) scale 0.35 translate <1.6, 0, -0.7> }


plane { y, -1 texture { pigment { color rgb 1 } finish { diffuse 1 } } }

//light_source { <-1500, 3500, -2000>, color rgb 1 }
light_source { < 1500, 3500, -1000>, color rgb 1 }

camera { location -12*z look_at 0 angle 20
  rotate <50, -20, 0> translate <0, 0, 0> }


// END ================================================================



//     Sputnik
//
//  ----------------------------

//  fr### [at] computermuseumfh-kielde
//  ----------------------------


Post a reply to this message

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