|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Once again, folks, I'm at the curved triangle thingy!!!
Anyway, I think this attempt came out better. Take a look at my picture in
p.b.i and, if interested, the source in p.b.s-f. The include file contains
a description of how to use it, but if you have any questions feel free to
ask.
BTW, it's late here, and I haven't had time to try any meshes with it.
Please let me know if you run into problems doing so (smooth triangles
should convert without problems, but you never know).
...Chambers
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Ben Chambers wrote:
>
> Once again, folks, I'm at the curved triangle thingy!!!
>
> Anyway, I think this attempt came out better. Take a look at my
> picture in p.b.i and, if interested, the source in p.b.s-f. The
> include file contains a description of how to use it, but if you
> have any questions feel free to ask.
>
> BTW, it's late here, and I haven't had time to try any meshes with it.
> Please let me know if you run into problems doing so (smooth triangles
> should convert without problems, but you never know).
I have some code (untested--Rusty takes priority!) that implements
a quartic triangular Bezier patch. There is supposedly an algorithm
by which a Loop subdivision surface can be converted into a bunch of
these (which makes them much easier to implement).
Regards,
John
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"John VanSickle" <evi### [at] hotmailcom> wrote in message
news:3D1B59E3.54F30927@hotmail.com...
> > BTW, it's late here, and I haven't had time to try any meshes with it.
> > Please let me know if you run into problems doing so (smooth triangles
> > should convert without problems, but you never know).
>
> I have some code (untested--Rusty takes priority!) that implements
> a quartic triangular Bezier patch. There is supposedly an algorithm
> by which a Loop subdivision surface can be converted into a bunch of
> these (which makes them much easier to implement).
All the effort I put into it, and the code already exists somewhere
else?!?!? Aaaaargh!
That's what I get for not researching the topic first!
BTW, where is that code you were talking about?
...Chambers
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Ben Chambers wrote:
>
> "John VanSickle" <evi### [at] hotmailcom> wrote in message
> news:3D1B59E3.54F30927@hotmail.com...
> > > BTW, it's late here, and I haven't had time to try any meshes
> > > with it. Please let me know if you run into problems doing so
> > > (smooth triangles should convert without problems, but you never
> > > know).
> >
> > I have some code (untested--Rusty takes priority!) that implements
> > a quartic triangular Bezier patch. There is supposedly an algorithm
> > by which a Loop subdivision surface can be converted into a bunch of
> > these (which makes them much easier to implement).
>
> All the effort I put into it, and the code already exists somewhere
> else?!?!? Aaaaargh!
>
> That's what I get for not researching the topic first!
Yup. Google is wonderful, but only if you use it.
> BTW, where is that code you were talking about?
Here is the UNTESTED code:
// start of macro code
#macro TriBezier(pA,pB,pC,pD,pE,pF,pG,pH,pI,pJ,pK,pL,pM,pN,pO,cD)
#if(cD<1)
smooth_triangle {
A,vcross(C-A,B-A),
K,vcross(G-K,L-K),
O,vcross(N-O,J-O)
}
#else
TriBezier(A,(A+B)/2,(A+C)/2,(A+2*B+D)/4,(A+B+C+E)/4,(A+2*C+F)/4,
(A+3*B+3*D+G)/8,(A+2*B+D+C+2*E+H)/8,(A+2*C+F+B+2*E+I)/8,
(A+3*C+3*F+J)/8,(A+4*B+6*D+4*G+K)/16,(A+3*B+3*D+G+C+3*E+3*H+L)/16,
(A+2*C+F+2*B+4*E+2*I+D+2*H+M)/16,(A+3*C+3*F+J+B+3*E+3*I+N)/16,
(A+4*C+6*F+4*J+O)/16,cD-1)
TriBezier((A+4*B+6*D+4*G+K)/16,(B+3*D+3*G+K)/8,(B+C+3*D+3*E+3*G+3*H+K+L)/16,
(D+2*G+K)/4,(D+E+2*G+2*H+K+L)/8,(D+2*E+F+2*G+4*H+2*I+K+2*L+M)/16,
(G+K)/2,(G+H+K+L)/4,(G+2*H+I+K+2*L+M)/8,(G+3*H+3*I+J+K+3*L+3*M+N)/16,
K,(K+L)/2,(K+2*L+M)/4,(K+3*L+3*M+N)/8,(K+4*L+6*M+4*N+O)/16,cD-1)
TriBezier((A+4*C+6*F+4*J+O)/16,(B+C+3*E+3*F+3*I+3*J+N+O)/16,
(C+3*F+3*J+O)/8,(D+2*E+F+2*H+4*I+2*J+M+2*N+O)/16,(E+F+2*I+2*J+N+O)/8,
(F+2*J+O)/4,(G+3*H+3*I+J+L+3*M+3*N+O)/16,(H+2*I+J+M+2*N+O)/8,
(I+J+N+O)/4,(J+O)/2(K+4*L+6*M+4*N+O)/16,(L+3*M+3*N+O)/8,(M+2*N+O)/4,
(N+O)/2,O,cD-1)
TriBezier((A+4*B+6*D+4*G+K)/16,(A+3*B+3*D+G+C+3*E+3*H+L)/16,
(A+2*B+D+2*C+4*E+2*H+F+2*I+M)/16(A+3*C+3*F+J+B+3*E+3*I+N)/16,
(A+4*C+6*F+4*J+O)/16,(B+C+3*D+3*E+3*G+3*H+K+L)/16,
(B+C+2*D+3*E+F+G+3*H+2*I+L+M)/16,(B+C+D+3*E+2*F+2*H+3*I+J+M+N)/16,
(B+C+3*E+3*F+3*I+3*J+N+O)/16,(D+2*E+F+2*G+4*H+2*I+K+2*L+M)/16,
(D+2*E+F+G+3*H+3*I+J+L+2*M+N)/16,(D+2*E+F+2*H+4*I+2*J+M+2*N+O)/16,
(G+3*H+3*I+J+K+3*L+3*M+N)/16,(G+3*H+3*I+J+L+3*M+3*N+O)/16,
(K+4*L+6*M+4*N+O)/16,cD-1)
#end
#end
// end of macro code
I am also generalizing my surface subdivision code to include four-
sided faces (which helps solve a couple of problems with uv-mapping).
That project isn't done yet.
Regards,
John
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"John VanSickle" <evi### [at] hotmailcom> wrote in message
news:3D1DCAD0.90317117@hotmail.com...
> Here is the UNTESTED code:
>
> // start of macro code
> #macro TriBezier(pA,pB,pC,pD,pE,pF,pG,pH,pI,pJ,pK,pL,pM,pN,pO,cD)
> #if(cD<1)
> smooth_triangle {
> A,vcross(C-A,B-A),
> K,vcross(G-K,L-K),
> O,vcross(N-O,J-O)
> }
> #else
> TriBezier(A,(A+B)/2,(A+C)/2,(A+2*B+D)/4,(A+B+C+E)/4,(A+2*C+F)/4,
> (A+3*B+3*D+G)/8,(A+2*B+D+C+2*E+H)/8,(A+2*C+F+B+2*E+I)/8,
> (A+3*C+3*F+J)/8,(A+4*B+6*D+4*G+K)/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N+O)/16,
> (G+3*H+3*I+J+K+3*L+3*M+N)/16,(G+3*H+3*I+J+L+3*M+3*N+O)/16,
> (K+4*L+6*M+4*N+O)/16,cD-1)
> #end
> #end
>
> // end of macro code
Hmm, seems just a little bit messy. Where on the triangle are the control
points placed? (One thing I wanted to achieve with mine is that it uses no
more data than the original triangle - three points, and three normals, so
control points don't have to be generated).
...Chambers
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Ben Chambers wrote:
>
> Hmm, seems just a little bit messy. Where on the triangle are the
> control points placed? (One thing I wanted to achieve with mine is
> that it uses no more data than the original triangle - three points,
> and three normals, so control points don't have to be generated).
There is a site that has a PDF describing how to get the control
points for a cubic Bezier triangular patch, derived from the corners
and normals of that corner. It's here:
http://www-courses.cs.uiuc.edu/~cs319/subdiv.pdf
It won't handle sharp edges (which are important for most work). Note
that this is for CUBIC patches, whereas the code I gave above is for
quartic patches. For cubic patches, you'd need this macro:
// start of macro code
#macro CubicTriPatch(A,B,C,D,E,F,G,H,I,J,cD)
#if(cD<1)
smooth_triangle { A,vcross(C-A,B-A),
G,vcross(D-G,H-G),J,vcross(I-J,F-J) }
#else
CubicTriPatch(A,(A+B)/2,(A+C)/2,(A+2*B+D)/4,(A+B+C+E)/4,(A+2*C+F)/4,
(A+3*B+3*D+G)/8,(A+2*B+D+C+2*E+H)/8,(A+B+2*C+2*E+F+I)/8,
(A+3*C+3*F+J)/8,cD-1 )
CubicTriPatch(G,(G+H)/2,(D+G)/2,(G+2*H+I)/4,(D+E+G+H)/4,(B+2*D+G)/4,
(G+3*H+3*I+J)/8,(D+2*E+F+G+2*H+I)/8,(G+H+2*D+2*E+B+C)/8,
(A+3*B+3*D+G)/8,cD-1 )
CubicTriPatch(J,(J+F)/2,(I+J)/2,(J+2*F+C)/4,(E+F+I+J)/4,(H+2*I+J)/4,
(A+3*C+3*F+J)/8,(I+2*E+B+J+2*F+C)/8,(J+F+2*I+2*E+H+D)/8,
(G+3*H+3*I+J)/8,cD-1 )
CubicTriPatch((A+3*B+3*D+G)/8,(A+2*B+D+C+2*E+H)/8,
(A+B+2*C+2*E+F+I)/8,(A+3*C+3*F+J)/8,(G+H+2*D+2*E+B+C)/8,
(B+C+D+2*E+F+H+I)/8,(I+2*E+B+J+2*F+C)/8,(D+2*E+F+G+2*H+I)/8,
(D+2*E+F+H+2*I+J)/8,(G+3*H+3*I+J)/8,cD-1 )
#end
#end
// end of macro code
Regards,
John
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|