POV-Ray : Newsgroups : povray.general : Edge detection Server Time
26 Dec 2024 08:17:58 EST (-0500)
  Edge detection (Message 1 to 4 of 4)  
From: Bald Eagle
Subject: Edge detection
Date: 12 Aug 2013 21:15:01
Message: <web.520988444c309d673fc9ebb0@news.povray.org>
Does anyone use edge detection software, or some other "tool" to speed up
defining the spline points for things like SOR's or lathes?

It would be useful to RAPIDLY "scan" the edges of image files of actual lathe
objects and produce a series of x,y data points to be spun into an SOR or lathe
object.


Post a reply to this message

From: Anthony D  Baye
Subject: Re: Edge detection
Date: 12 Aug 2013 22:00:04
Message: <web.520992ef29bc8274328783aa0@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> Does anyone use edge detection software, or some other "tool" to speed up
> defining the spline points for things like SOR's or lathes?
>
> It would be useful to RAPIDLY "scan" the edges of image files of actual lathe
> objects and produce a series of x,y data points to be spun into an SOR or lathe
> object.

You can create splines using Inkscape.  I also have a set of LOGO turtle macros
that can be used to create splines...

Regards,
A.D.B.


Post a reply to this message

From: Bald Eagle
Subject: Re: Edge detection
Date: 13 Aug 2013 00:30:01
Message: <web.5209b62a29bc827473fc9ebb0@news.povray.org>
> You can create splines using Inkscape.  I also have a set of LOGO turtle macros
> that can be used to create splines...

I like it.  How do I take the points from the path generated by Trace Bitmap and
import those coordinates into POV-Ray?

LOGO.  I wouldn't have thought of that.  I like the simple stuff.
Does it work well?


Post a reply to this message

From: Anthony D  Baye
Subject: Re: Edge detection
Date: 13 Aug 2013 03:05:05
Message: <web.5209d9c029bc8274328783aa0@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> > You can create splines using Inkscape.  I also have a set of LOGO turtle macros
> > that can be used to create splines...
>
> I like it.  How do I take the points from the path generated by Trace Bitmap and
> import those coordinates into POV-Ray?

I'm not sure.  I've never used it myself, but if you can export as either an svg
file or rawtext, you can copy the points directly using a text editor.

>
> LOGO.  I wouldn't have thought of that.  I like the simple stuff.
> Does it work well?

I created them so I could do some experiments with 2D fractals; Things like Koch
flakes and Gosper islands.  I've included a DUMP() macro which takes a single
argument that will dump the contents of the lSpline array to a file as a natural
spline.

before using any of the other macros you need to call Init() - this sets up the
environment variables for the "turtle".  Calling Init() again will reset the
environment, so you can construct multiple splines in one file.

the fd() and

The logo_prism object is, as the name suggests, a prism made from the lSpline
array.

points are only appended to lSpline if _Draw_ = true, you can use pu() and pd()
to set that.  (This is handy for making complex splines)

I haven't played with these in a while, so they're a bit rough around the edges.
 Feel free to tinker with the code.

I hope you find them useful.

Regards,
A.D.B.

#include "kolors.inc"
#include "math.inc"
#include "arrays.inc"

#macro init()
#ifdef(logo_prism)
    #undef(logo_prism)
#end
#declare _cP_ = <0.0, 0.0, 0.0>;
#declare _cD_ = 0;
#declare _DRAW_ = true;
#declare _MAX_SIZE_ = 100000000;
#declare _SPLINE_SIZE_ = 0;
#declare lSpline = array[1] {<0,0>};
#end

// Pen Up
#macro pu()
     #declare _DRAW_ = false;
#end

// Pen Down
#macro pd()
     #declare _DRAW_ = true;
#end

// left turn (degrees)
#macro lt(d)
     #declare _cD_ = _cD_ + d;
     #if(_cD_ > 360)
          #declare _cD_ = _cD_ - 360;
     #end
#end

// right turn (degrees)
#macro rt(d)
     #declare _cD_ = _cD_ - d;
     #if(_cD_ < -360)
          #declare _cD_ = _cD_ + 360;
     #end
#end

// foreward (length)
#macro fd(l)
     #local _pL_ = _cP_;
     #declare _cP_ = _cP_ + l*<cosd(_cD_), sind(_cD_), 0>;

     #if(_DRAW_)
//        cylinder { _pL_, _cP_, 0.015625 pigment {Orange}
//             finish { ambient 0.6 diffuse 0.3 } }
          #if(_SPLINE_SIZE_ = 0)
               #declare lSpline[0] = <_pL_.x,_pL_.y>;
//               #debug concat("adding " vstr(2,_cP_,", ",0 ,4) " to lSpline\n")
          #else
               Resize_Array(lSpline, _SPLINE_SIZE_ + 1)
               #declare lSpline[_SPLINE_SIZE_] = <_cP_.x,_cP_.y>;
          #end
          #declare _SPLINE_SIZE_ = _SPLINE_SIZE_ + 1;
//        #debug concat("current point = " vstr(2,lSpline[_SPLINE_SIZE_-1],",
",0 ,4) "\n")
     #end
//     #debug concat("moving to: " vstr(2,_cP_,", ",0 ,4) "\n")
#end

#macro DUMP(fName)

#local OPEN = concat("spline {\nnatural_spline\n", str(_SPLINE_SIZE_,0,0), "\n")
#local CLOSE = "\n}\n";

#fopen DUMP_FILE fName write
#write(DUMP_FILE, OPEN)
#local j = 0;
#while(j < _SPLINE_SIZE_)
     #local OUTPUT = concat(str(j/_SPLINE_SIZE_,0,4)", <"str(lSpline[j].u,0,4)
", " str(lSpline[j].v,0,4) ">\n")
     #write(DUMP_FILE, OUTPUT)
//     #debug OUTPUT
#local j = j + 1;
#end
#write(DUMP_FILE, CLOSE)
#fclose DUMP_FILE

#end

#macro PRISM(i, f)

#declare logo_prism =
prism {
     linear_sweep
     linear_spline
     i, f, _SPLINE_SIZE_
#local c = 0;
#while(c < _SPLINE_SIZE_)
     <lSpline[c].u, lSpline[c].v>
#local c = c + 1;
#end
     }

#end


Post a reply to this message

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