POV-Ray : Newsgroups : povray.general : convert to sPatch? : Re: convert to sPatch? Server Time
28 Jul 2024 18:16:17 EDT (-0400)
  Re: convert to sPatch?  
From: Panayotis Kouvarakis
Date: 8 Dec 1970 15:29:41
Message: <01bd045f$196cb200$e76b5cc1@kav.forthnet.gr>
Joshua Boyd <bud### [at] aolcom> wrote in article <348### [at] aolcom>...
> Simeon Alexander Scott wrote:
> > 
> > Anyone know of any utilities which will convert something to an sPatch
> >  file? I have a 2D file I would like to import to sPatch, so I can
> > extrude it.
> > 
> > Any converter at all would be better than no converter!
> 
> Err, currently no one has published a spec for the files system.  I have
> tried to reverse engineer it, but I don't really know that much about
> bezier patches, so it didn't go well.  If any one wants to help me, I am
> game.
> 

I took a look to sPatch's files and they seem to be plain ASCII ones. I'll
try to explain the structure of the files using an example file i created
in sPatch to help me decipher it. Lines starting with ';' are my comments
and (I don't really know if it matters but) there shouldn't be any blank
lines in between (I've added them for readability):

sPatches
; This is just a label to simplify the parser and identify the file as
sPatch scene

version 2
; obviously the version number (version 1 is similar but the layer # are
missing)

visibility FALSE
; I don't understand this very well but it seems to be FALSE no matter what

selection FALSE
; Same goes for this one. Never seen it be TRUE

num_points 9
; The number of points in the scene (numbered 0 to 8 for this scene)

	-1.500000 -0.342857 0.000000
	; The coordinates of point #0 (<x> <y> <z>  I presume)

		0
		; The layer # on which this point lies (0 based)

		0
		; Always 0. Don't know what it is

		1
		; The number of curves passing from this point

		0 2
		; The curve # followed by the position in the curve's point list 
		; (0 based, see later in the 'curves' section)
		; there is one such line for each curve that passes from this point


	; Now the same applies for the rest of the points in the scene
	-2.385714 0.300000 0.000000
		0
		0
		1
		0 1
	-1.842857 1.414286 0.000000
		0
		0
		1
		1 1
	-1.714286 0.828571 0.000000
		0
		0
		2	; here is an example of a point with 2 curves
		1 2	; there are two lines, one for each curve
		0 0
	0.100000 1.428571 0.000000
		1
		0
		1
		2 0
	0.100000 0.728571 0.000000
		1
		0
		1
		2 1
	1.414286 1.100000 0.000000
		2
		0
		1
		3 0
	0.571429 1.100000 0.000000
		2
		0
		1
		3 1
	-0.985714 0.614286 0.000000
		0
		0
		1
		1 0

; The above blank line was already there!

num_curves 4
; And now the curves section, there are 4 curves (0 based too)

	3 0
	; the first is defined by 3 points and it is open 
	; (0=open, 1=closed, like a loop)
	; then follow the lines that describe the points (one for each point)

		3 1 0.300000
		; The values here are: <point #>, <smooth flag>, <curve fitting factor>
		; <smooth flag> is 1 if the curve is smooth passing from this point
		; or 0 if it makes a pointed turn

		1 0 0.300000
		0 1 0.300000
	3 1	; this curve is closed
		8 1 0.300000
		2 1 0.300000
		3 1 0.300000
	2 0
		4 1 0.300000
		5 1 0.300000
	2 0
		6 1 0.300000
		7 1 0.300000
end_patches
; And this is the end of the sPatch file.

As you can see it is quite simple (apart from some dark spots!) so it
shouldn't be much trouble to create a converter for this file format as
long as you can decode the source file you want to convert to sPatch. If it
just a series of 2D coordinates (or something quite simple) I could
possibly write a converter for you. The only problem is at the moment (due
to a total reorganization of my PC) that the only developing tool I have
available is VB 4.0 so you'll need the runtimes. If you already have them
(or have VB 4.0 installed) send me a sample of the file you want to convert
and see if I can make anything out of if.


Post a reply to this message

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