Metaprogramming for the Generation of Nonparametric Curves - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

Metaprogramming for the Generation of Nonparametric Curves

Description:

Metaprogramming for the Generation of Nonparametric Curves. Vincent BOYER. Groupe de Recherche en Infographie et ... Results for a parabola. EG'01 - G.R.I.S. ... – PowerPoint PPT presentation

Number of Views:33
Avg rating:3.0/5.0
Slides: 14
Provided by: aiUniv
Category:

less

Transcript and Presenter's Notes

Title: Metaprogramming for the Generation of Nonparametric Curves


1
Metaprogramming for the Generation of
Nonparametric Curves
  • Vincent BOYER
  • Groupe de Recherche en Infographie et Synthèse
    dimages
  • Department of Computer Science
  • Université Paris 8
  • Saint-Denis (France)

2
Metaprogramming for the Generation of
Nonparametric Curves
  • Introduction
  • Jordans algorithm
  • Metaprogramming
  • Conclusion

3
Introduction
void circle (int xc, int yc, int r) int x,
y, delta 3 - 2r for (xr, y0 yltx
y) Putpixel(xcx, ycy) if
(delta gt 0) delta 10 4(y-x)
x-- else
delta 6 4y
4
Jordans algorithm
  • Generalization of the DDA method

Continuous derivates
P
Q
5
Jordans algorithm
6
Jordans algorithm
  • To choose a point
  • To update partial derivates
  • gt For the next point

7
Metaprogramming
  • Automation of the Jordans method
  • User gt function
  • F(x, y) axx - y
  • F(x, y) ax by c
  • F(x, y) xx yy - rr

8
Metaprogramming
  • 1 to compute the derivates
  • 2 using the direction to compute and
  • 3 to compute
  • 4 to determine the value closest to zero

9
Metaprogramming
  • Programs same structure
  • Differences function and derivates
  • Generation of a new program
  • - a lexical analysis of F(x, y),
  • - the computation of the derivates,
  • - the creation of a new file,
  • - the creation of a header file,
  • - the compilation of the new program gt binary
    file.

10
Metaprogramming
  • Parameters for the program are
  • A starting point
  • An ending point
  • A direction
  • Values of the parameters of F(x, y)

11
Metaprogramming
define FONCTION axbyc define DERIVEEX
ax define DERIVEEY by Results for a line
  • Examples

define FONCTION axx-y define DERIVEEX
2ax define DERIVEEY 1 Results for a parabola
12
Metaprogramming
define NOM_H "x2.h" define MAX 1000 include
ltstdio.hgt include ltmath.hgt include NOM_H Int
min(int d0, int d1, int d2, int d3, int d4, int
d5, int d6, int d7) if ((d0ltd1) (d0ltd2)
(d0ltd3) (d0ltd4) (d0ltd5) (d0ltd6)
(d0ltd7)) return 0 else if ((d1ltd2)
(d1ltd3) (d1ltd4) (d1ltd5) (d1ltd6)
(d1ltd7)) return 1 else if ((d2ltd3)
(d2ltd4) (d2ltd5) (d2ltd6) (d2ltd7))
return 2 else if ((d3ltd4) (d3ltd5)
(d3ltd6) (d3ltd7)) return 3 else if
((d4ltd5) (d4ltd6) (d4ltd7)) return 4
else if ((d5ltd6) (d5ltd7)) return 5 else
if (d6ltd7) return 6 else return 7 int
derivee_x(int x) /ici je met la derivee en
x/ return(DERIVEEX) Int derivee_y(int y)
/ici la derivee en y/ return(DERIVEEY) Int
c_delta(int x, int y) /ici j'ecris la
fonction/ return ((abs)(FONCTION)) Void
DxDy(int x0, int y0, int direction, int Dx, int
Dy) if (((derivee_y(y0)gt0)
(direction0)) ((derivee_y(y0)lt0)
(direction1))) Dx1 if
(((derivee_y(y0)lt0) (direction0))
((derivee_y(y0)gt0) (direction1)))
Dx-1 if (((derivee_x(x0)lt0)
(direction0)) ((derivee_x(x0)gt0)
(direction1))) Dy1 if
(((derivee_x(x0)gt0) (direction0))
((derivee_x(x0)lt0) (direction1)))
Dy-1
Void main(int argc, char argv) int d0, d1,
d2, d3, d4, d5, d6, d7 int delta int x0,
y0 int taille int i int direction 1
int Dx, Dy delta -1 x0atoi(argv1)
y0atoi(argv2) tailleatoi(argv3)
for(i0ilttaillei) printf("d
d\n",x0,y0) DxDy(x0, y0, direction, Dx,
Dy) d0 (Dx1) ? c_delta(x01, y0)
MAX d1 ((Dx1) (Dy1)) ?
c_delta(x01, y01) MAX d2 (Dy1) ?
c_delta(x0, y01) MAX d3 ((Dx-1)
(Dy1)) ? c_delta(x0-1, y01) MAX d4
(Dx-1) ? c_delta(x0-1, y0) MAX d5
((Dx-1) (Dy-1)) ? c_delta(x0-1, y0-1)
MAX d6 (Dy-1) ? c_delta(x0, y0-1)
MAX d7 ((Dx1) (Dy-1)) ?
c_delta(x01, y0-1) MAX delta min(d0,
d1, d2, d3, d4, d5, d6, d7) if ((delta0)
(delta1) (delta7)) x0
else if ((delta4) (delta3)
(delta5)) x0-- if ((delta2)
(delta1) (delta3)) y0
else if ((delta5) (delta6)
(delta7)) y0--
13
Conclusions
  • Conclusions
  • Extension of the Jordans method
  • Generation of programs
  • Included in a paint box
  • Future works
  • Extension to three variables
  • Used for color shading
Write a Comment
User Comments (0)
About PowerShow.com