1. Barry Schwartz
  2. ebeno

Commits

Barry Schwartz  committed ed64f3c

Reorganized C headers. And now Pure calls C for geom algebra rather than going through Fortran. (The Fortran probably will be discarded.)

  • Participants
  • Parent commits 2290745
  • Branches default

Comments (0)

Files changed (14)

File Makefile.am

View file
 	fortran/geometric_algebra.f90 fortran/basic_geometry.f90		\
 	fortran/convex_hull.f90 fortran/brentroot.f90 fortran/curve.f90
 
-pkginclude_HEADERS = c/basic_algebra.h c/basic_geometry.h	\
-	c/convex_hull.h c/curve.h c/geometric_algebra.h
+pkginclude_HEADERS = c/ebeno/basic_algebra.h c/ebeno/basic_geometry.h	\
+	c/ebeno/convex_hull.h c/ebeno/curve.h c/ebeno/geometric_algebra.h
 
 pkgconfigdir="${libdir}/pkgconfig"
 nodist_pkgconfig_DATA = ebeno.pc
 ${srcdir}/c/ga.c: ${srcdir}/c/ga.h ${srcdir}/c/ga.xml
 	@$(force_rebuild)
 
+c/ebeno/geometric_algebra.h: ${srcdir}/c/ga.h
+	-$(MKDIR_P) ${builddir}/c/ebeno
+	cp $< $@
+
 EXTRA_DIST = ${srcdir}/c/ga.xml ${srcdir}/c/ga.c ${srcdir}/c/ga.h
 
 #--------------------------------------------------------------------------
 	pure/ebeno/geometric_algebra.pure pure/ebeno/linear_algebra.pure	\
 	pure/ebeno/machine.pure pure/ebeno/pascals_triangle.pure
 
-pure/ebeno/%_h.pure: c/%.h
+pure/ebeno/geometric_algebra_h.pure: c/ebeno/geometric_algebra.h
+	-$(MKDIR_P) ${builddir}/pure/ebeno
+	$(PUREGEN) -fffi -s"$<::" -o $@ $< -llibebeno
+
+pure/ebeno/%_h.pure: c/ebeno/%.h
 	-$(MKDIR_P) ${builddir}/pure/ebeno
 	$(PUREGEN) -o $@ $< -llibebeno
 

File c/basic_algebra.h

-extern void ebeno_quadratic_roots(double *coef, double *z);
-extern void ebeno_cubic_roots(double *coef, double *z);
-extern void ebeno_quartic_roots(double *coef, double *z);

File c/basic_geometry.h

-extern void ebeno_implicit_equ_of_2_points(double *p1, double *p2, double *line_equ);
-extern void ebeno_implicit_equ_of_normal(double *other_line_equ, double *p1, double *line_equ);
-extern void ebeno_fit_line(int count, double *points, double *line_equ, int *info);
-
-extern int ebeno_rectangle_insideness(double *corner1, double *corner2, double *point);
-extern int ebeno_rectangles_overlap(double *corner1, double *corner2, double *corner3, double *corner4);
-
-extern void ebeno_project_polygon_on_vector(int poly_size, double *polygon, double *vector, double *projection);
-extern int ebeno_convex_polygons_overlap(int size1, double *polygon1, int size2, double *polygon2);

File c/convex_hull.h

-extern void ebeno_monochain(int num_points, double *points,
-                            int task, int *hull_size, double *hull);
-extern void ebeno_convex_hull_line_intersect(int hull_size, double *hull,
-                                             double *line_equ,
-                                             double *intersections,
-                                             int *is_segment);
-extern void ebeno_convex_hull_xintercepts(int hull_size, double *hull,
-                                          double y, double *intercepts,
-                                          int *is_segment);
-extern void ebeno_convex_hull_yintercepts(int hull_size, double *hull,
-                                          double x, double *intercepts,
-                                          int *is_segment);
-extern int ebeno_convex_hull_insideness(int hull_size, double *hull,
-                                        double *point);
-extern int ebeno_convex_hulls_overlap(int hull1_size, double *hull1,
-                                      int hull2_size, double *hull2);

File c/curve.h

-extern void ebeno_convolve_np(int adegree, int bdegree, double *a, double *b, double *c);
-extern void ebeno_convolve_pa(int adegree, int bdegree, double *a, double *b, double *c);
-
-extern void ebeno_compose_be_np(int adegree, int bdegree, double *a, double *b, double *c);
-extern void ebeno_compose_be_pa(int adegree, int bdegree, double *a, double *b, double *c);
-extern void ebeno_compose_sb_np(int adegree, int bdegree, double *a, double *b, double *c);
-extern void ebeno_compose_sb_pa(int adegree, int bdegree, double *a, double *b, double *c);
-extern void ebeno_compose_mo_np(int adegree, int bdegree, double *a, double *b, double *c);
-extern void ebeno_compose_mo_pa(int adegree, int bdegree, double *a, double *b, double *c);
-extern void ebeno_compose_sr_np(int adegree, int bdegree, double *a, double *b, double *c);
-extern void ebeno_compose_sr_pa(int adegree, int bdegree, double *a, double *b, double *c);
-
-extern void ebeno_pow_be_np(int degree, double *b, int k, double *c);
-extern void ebeno_pow_be_pa(int degree, double *b, int k, double *c);
-extern void ebeno_pow_sb_np(int degree, double *b, int k, double *c);
-extern void ebeno_pow_sb_pa(int degree, double *b, int k, double *c);
-extern void ebeno_pow_mo_np(int degree, double *b, int k, double *c);
-extern void ebeno_pow_mo_pa(int degree, double *b, int k, double *c);
-extern void ebeno_pow_sr_np(int degree, double *b, int k, double *c);
-extern void ebeno_pow_sr_pa(int degree, double *b, int k, double *c);
-
-extern void ebeno_elev_be_np(int degree, double *b, int n, double *c);
-extern void ebeno_elev_be_pa(int degree, double *b, int n, double *c);
-extern void ebeno_elev_be_np_many(int degree, int count, double *b, int n, double *c);
-extern void ebeno_elev_be_pa_many(int degree, int count, double *b, int n, double *c);
-extern void ebeno_elev_sb_np(int degree, double *b, int n, double *c);
-extern void ebeno_elev_sb_pa(int degree, double *b, int n, double *c);
-extern void ebeno_elev_sb_np_many(int degree, int count, double *b, int n, double *c);
-extern void ebeno_elev_sb_pa_many(int degree, int count, double *b, int n, double *c);
-extern void ebeno_elev_mo_np(int degree, double *b, int n, double *c);
-extern void ebeno_elev_mo_pa(int degree, double *b, int n, double *c);
-extern void ebeno_elev_mo_np_many(int degree, int count, double *b, int n, double *c);
-extern void ebeno_elev_mo_pa_many(int degree, int count, double *b, int n, double *c);
-extern void ebeno_elev_sr_np(int degree, double *b, int n, double *c);
-extern void ebeno_elev_sr_pa(int degree, double *b, int n, double *c);
-extern void ebeno_elev_sr_np_many(int degree, int count, double *b, int n, double *c);
-extern void ebeno_elev_sr_pa_many(int degree, int count, double *b, int n, double *c);
-
-extern void ebeno_plus_be_np(int adegree, int bdegree, double *a, double *b, double *c);
-extern void ebeno_plus_be_pa(int adegree, int bdegree, double *a, double *b, double *c);
-extern void ebeno_plus_sb_np(int adegree, int bdegree, double *a, double *b, double *c);
-extern void ebeno_plus_sb_pa(int adegree, int bdegree, double *a, double *b, double *c);
-extern void ebeno_plus_mo_np(int adegree, int bdegree, double *a, double *b, double *c);
-extern void ebeno_plus_mo_pa(int adegree, int bdegree, double *a, double *b, double *c);
-extern void ebeno_plus_sr_np(int adegree, int bdegree, double *a, double *b, double *c);
-extern void ebeno_plus_sr_pa(int adegree, int bdegree, double *a, double *b, double *c);
-
-extern void ebeno_minus_be_np(int adegree, int bdegree, double *a, double *b, double *c);
-extern void ebeno_minus_be_pa(int adegree, int bdegree, double *a, double *b, double *c);
-extern void ebeno_minus_sb_np(int adegree, int bdegree, double *a, double *b, double *c);
-extern void ebeno_minus_sb_pa(int adegree, int bdegree, double *a, double *b, double *c);
-extern void ebeno_minus_mo_np(int adegree, int bdegree, double *a, double *b, double *c);
-extern void ebeno_minus_mo_pa(int adegree, int bdegree, double *a, double *b, double *c);
-extern void ebeno_minus_sr_np(int adegree, int bdegree, double *a, double *b, double *c);
-extern void ebeno_minus_sr_pa(int adegree, int bdegree, double *a, double *b, double *c);
-
-extern void ebeno_mul_be_np(int adegree, int bdegree, double *a, double *b, double *c);
-extern void ebeno_mul_be_pa(int adegree, int bdegree, double *a, double *b, double *c);
-extern void ebeno_mul_sr_np(int adegree, int bdegree, double *a, double *b, double *c);
-extern void ebeno_mul_sr_pa(int adegree, int bdegree, double *a, double *b, double *c);
-
-extern void ebeno_split_sr_np(int degree, double *b, double *c);
-extern void ebeno_split_sr_pa(int degree, double *b, double *c);
-extern void ebeno_unsplit_sr_np(int degree, double *c, double *b);
-extern void ebeno_unsplit_sr_pa(int degree, double *c, double *b);
-
-extern void ebeno_dropterms_mo_np(int degree, double *b, int n, double *c);
-extern void ebeno_dropterms_mo_pa(int degree, double *b, int n, double *c);
-extern void ebeno_dropterms_mo_np_many(int degree, int count, double *b, int n, double *c);
-extern void ebeno_dropterms_mo_pa_many(int degree, int count, double *b, int n, double *c);
-
-extern void ebeno_dropterms_sr_np(int degree, double *b, int n, double *c);
-extern void ebeno_dropterms_sr_pa(int degree, double *b, int n, double *c);
-extern void ebeno_dropterms_sr_np_many(int degree, int count, double *b, int n, double *c);
-extern void ebeno_dropterms_sr_pa_many(int degree, int count, double *b, int n, double *c);
-
-extern int ebeno_mindeg_be_np(int degree, double *b);
-extern int ebeno_mindeg_be_pa(int degree, double *b);
-extern int ebeno_mindeg_sb_np(int degree, double *b);
-extern int ebeno_mindeg_sb_pa(int degree, double *b);
-extern int ebeno_mindeg_mo_np(int degree, double *b);
-extern int ebeno_mindeg_mo_pa(int degree, double *b);
-extern int ebeno_mindeg_sr_np(int degree, double *b);
-extern int ebeno_mindeg_sr_pa(int degree, double *b);
-
-extern void ebeno_deriv_be_np(int degree, double *b, double *d);
-extern void ebeno_deriv_be_pa(int degree, double *b, double *d);
-extern void ebeno_deriv_be_np_many(int degree, int count, double *b, double *d);
-extern void ebeno_deriv_be_pa_many(int degree, int count, double *b, double *d);
-extern void ebeno_deriv_sb_np(int degree, double *b, double *d);
-extern void ebeno_deriv_sb_pa(int degree, double *b, double *d);
-extern void ebeno_deriv_sb_np_many(int degree, int count, double *b, double *d);
-extern void ebeno_deriv_sb_pa_many(int degree, int count, double *b, double *d);
-extern void ebeno_deriv_mo_np(int degree, double *b, double *d);
-extern void ebeno_deriv_mo_pa(int degree, double *b, double *d);
-extern void ebeno_deriv_mo_np_many(int degree, int count, double *b, double *d);
-extern void ebeno_deriv_mo_pa_many(int degree, int count, double *b, double *d);
-extern void ebeno_deriv_sr_np(int degree, double *b, double *d);
-extern void ebeno_deriv_sr_pa(int degree, double *b, double *d);
-extern void ebeno_deriv_sr_np_many(int degree, int count, double *b, double *d);
-extern void ebeno_deriv_sr_pa_many(int degree, int count, double *b, double *d);
-
-extern double ebeno_dir_be_np(int degree, double *b, double t);
-extern void ebeno_dir_be_pa(int degree, double *b, double t, double *dir);
-extern double ebeno_dir_sb_np(int degree, double *b, double t);
-extern void ebeno_dir_sb_pa(int degree, double *b, double t, double *dir);
-extern double ebeno_dir_mo_np(int degree, double *b, double t);
-extern void ebeno_dir_mo_pa(int degree, double *b, double t, double *dir);
-extern double ebeno_dir_sr_np(int degree, double *b, double t);
-extern void ebeno_dir_sr_pa(int degree, double *b, double t, double *dir);
-
-extern void ebeno_sb_of_be_np(int degree, double *b, double *c);
-extern void ebeno_sb_of_be_pa(int degree, double *b, double *c);
-extern void ebeno_be_of_sb_np(int degree, double *b, double *c);
-extern void ebeno_be_of_sb_pa(int degree, double *b, double *c);
-extern void ebeno_sb_of_be_np_many(int degree, int count, double *b, double *c);
-extern void ebeno_sb_of_be_pa_many(int degree, int count, double *b, double *c);
-extern void ebeno_be_of_sb_np_many(int degree, int count, double *b, double *c);
-extern void ebeno_be_of_sb_pa_many(int degree, int count, double *b, double *c);
-
-extern void ebeno_mo_of_be_np(int degree, double *b, double *c);
-extern void ebeno_mo_of_be_pa(int degree, double *b, double *c);
-extern void ebeno_be_of_mo_np(int degree, double *b, double *c);
-extern void ebeno_be_of_mo_pa(int degree, double *b, double *c);
-extern void ebeno_mo_of_be_np_many(int degree, int count, double *b, double *c);
-extern void ebeno_mo_of_be_pa_many(int degree, int count, double *b, double *c);
-extern void ebeno_be_of_mo_np_many(int degree, int count, double *b, double *c);
-extern void ebeno_be_of_mo_pa_many(int degree, int count, double *b, double *c);
-
-extern void ebeno_mo_of_sb_np(int degree, double *b, double *c);
-extern void ebeno_mo_of_sb_pa(int degree, double *b, double *c);
-extern void ebeno_sb_of_mo_np(int degree, double *b, double *c);
-extern void ebeno_sb_of_mo_pa(int degree, double *b, double *c);
-extern void ebeno_mo_of_sb_np_many(int degree, int count, double *b, double *c);
-extern void ebeno_mo_of_sb_pa_many(int degree, int count, double *b, double *c);
-extern void ebeno_sb_of_mo_np_many(int degree, int count, double *b, double *c);
-extern void ebeno_sb_of_mo_pa_many(int degree, int count, double *b, double *c);
-
-extern void ebeno_sr_of_be_np(int degree, double *b, double *c);
-extern void ebeno_sr_of_be_pa(int degree, double *b, double *c);
-extern void ebeno_be_of_sr_np(int degree, double *b, double *c);
-extern void ebeno_be_of_sr_pa(int degree, double *b, double *c);
-extern void ebeno_sr_of_be_np_many(int degree, int count, double *b, double *c);
-extern void ebeno_sr_of_be_pa_many(int degree, int count, double *b, double *c);
-extern void ebeno_be_of_sr_np_many(int degree, int count, double *b, double *c);
-extern void ebeno_be_of_sr_pa_many(int degree, int count, double *b, double *c);
-
-extern void ebeno_sr_of_sb_np(int degree, double *b, double *c);
-extern void ebeno_sr_of_sb_pa(int degree, double *b, double *c);
-extern void ebeno_sb_of_sr_np(int degree, double *b, double *c);
-extern void ebeno_sb_of_sr_pa(int degree, double *b, double *c);
-extern void ebeno_sr_of_sb_np_many(int degree, int count, double *b, double *c);
-extern void ebeno_sr_of_sb_pa_many(int degree, int count, double *b, double *c);
-extern void ebeno_sb_of_sr_np_many(int degree, int count, double *b, double *c);
-extern void ebeno_sb_of_sr_pa_many(int degree, int count, double *b, double *c);
-
-extern void ebeno_mo_of_sr_np(int degree, double *b, double *c);
-extern void ebeno_mo_of_sr_pa(int degree, double *b, double *c);
-extern void ebeno_sr_of_mo_np(int degree, double *b, double *c);
-extern void ebeno_sr_of_mo_pa(int degree, double *b, double *c);
-extern void ebeno_mo_of_sr_np_many(int degree, int count, double *b, double *c);
-extern void ebeno_mo_of_sr_pa_many(int degree, int count, double *b, double *c);
-extern void ebeno_sr_of_mo_np_many(int degree, int count, double *b, double *c);
-extern void ebeno_sr_of_mo_pa_many(int degree, int count, double *b, double *c);
-
-extern double ebeno_eval_be_np(int degree, double *b, double t);
-extern void ebeno_eval_be_pa(int degree, double *b, double t, double *v);
-extern double ebeno_eval_sb_np(int degree, double *b, double t);
-extern void ebeno_eval_sb_pa(int degree, double *b, double t, double *v);
-extern double ebeno_eval_mo_np(int degree, double *b, double t);
-extern void ebeno_eval_mo_pa(int degree, double *b, double t, double *v);
-extern double ebeno_eval_sr_np(int degree, double *b, double t);
-extern void ebeno_eval_sr_pa(int degree, double *b, double t, double *v);
-
-extern void ebeno_subdiv_be_np(int degree, double *b, double t, double *c);
-extern void ebeno_subdiv_sb_np(int degree, double *b, double t, double *c);
-extern void ebeno_subdiv_mo_np(int degree, double *b, double t, double *c);
-extern void ebeno_subdiv_sr_np(int degree, double *b, double t, double *c);
-extern void ebeno_subdiv_be_pa(int degree, double *b, double t, double *c);
-extern void ebeno_subdiv_sb_pa(int degree, double *b, double t, double *c);
-extern void ebeno_subdiv_mo_pa(int degree, double *b, double t, double *c);
-extern void ebeno_subdiv_sr_pa(int degree, double *b, double t, double *c);
-extern void ebeno_subdiv_be_np_many(int degree, int t_count, double *b, double *t, double *c);
-extern void ebeno_subdiv_sb_np_many(int degree, int t_count, double *b, double *t, double *c);
-extern void ebeno_subdiv_mo_np_many(int degree, int t_count, double *b, double *t, double *c);
-extern void ebeno_subdiv_sr_np_many(int degree, int t_count, double *b, double *t, double *c);
-extern void ebeno_subdiv_be_pa_many(int degree, int t_count, double *b, double *t, double *c);
-extern void ebeno_subdiv_sb_pa_many(int degree, int t_count, double *b, double *t, double *c);
-extern void ebeno_subdiv_mo_pa_many(int degree, int t_count, double *b, double *t, double *c);
-extern void ebeno_subdiv_sr_pa_many(int degree, int t_count, double *b, double *t, double *c);
-
-extern void ebeno_portion_be_np(int degree, double *b, double *t, double *c);
-extern void ebeno_portion_sb_np(int degree, double *b, double *t, double *c);
-extern void ebeno_portion_mo_np(int degree, double *b, double *t, double *c);
-extern void ebeno_portion_sr_np(int degree, double *b, double *t, double *c);
-extern void ebeno_portion_be_pa(int degree, double *b, double *t, double *c);
-extern void ebeno_portion_sb_pa(int degree, double *b, double *t, double *c);
-extern void ebeno_portion_mo_pa(int degree, double *b, double *t, double *c);
-extern void ebeno_portion_sr_pa(int degree, double *b, double *t, double *c);
-
-extern void ebeno_findroots_be_np(int degree, double *b, int *root_count, double *roots);
-extern void ebeno_findroots_sb_np(int degree, double *b, int *root_count, double *roots);
-extern void ebeno_findroots_sr_np(int degree, double *b, int *root_count, double *roots);
-
-extern void ebeno_inflections_be_np(int degree, double *b, int *time_count, double *times);
-extern void ebeno_inflections_be_pa(int degree, double *b, int *time_count, double *times);
-extern void ebeno_inflections_sb_np(int degree, double *b, int *time_count, double *times);
-extern void ebeno_inflections_sb_pa(int degree, double *b, int *time_count, double *times);
-extern void ebeno_inflections_sr_np(int degree, double *b, int *time_count, double *times);
-extern void ebeno_inflections_sr_pa(int degree, double *b, int *time_count, double *times);
-
-extern void ebeno_bounds_be_pa(int degree, double *b, double *bounds);
-extern void ebeno_bounds_be_pa_many(int degree, int count, double *b, double *bounds);
-
-extern int ebeno_excludexsect_be_pa_hulls(int adegree, int bdegree, double *a, double *b);
-extern int ebeno_excludexsect_be_pa_rects(int adegree, int bdegree, double *a, double *b);
-
-extern void ebeno_fatline_be_pa(int degree, double *b, double *line_equ, double *fatline);
-extern void ebeno_fatline_be_pa_along_endpt(int degree, double *b, double *fatline);
-extern void ebeno_fatline_be_pa_pair(int degree, double *b, double *fatlines);
-
-extern void ebeno_cliptimes_be_pa(int degree, double *b, double *fatline, double *times);
-extern void ebeno_cliptimes_be_pa_many(int degree, double *b, int fatline_count, double *fatlines, double *times);
-
-extern double ebeno_fatline_flatness(double *fatline);
-extern double ebeno_fatline_flatness_many(double *fatlines);
-
-extern void ebeno_intersect_be_pa(int adegree, int bdegree, double *a, double *b,
-                                  int max_times, int *time_count, double *atimes,
-                                  double *btimes, double *points);

File c/ebeno/basic_algebra.h

View file
+extern void ebeno_quadratic_roots(double *coef, double *z);
+extern void ebeno_cubic_roots(double *coef, double *z);
+extern void ebeno_quartic_roots(double *coef, double *z);

File c/ebeno/basic_geometry.h

View file
+extern void ebeno_implicit_equ_of_2_points(double *p1, double *p2, double *line_equ);
+extern void ebeno_implicit_equ_of_normal(double *other_line_equ, double *p1, double *line_equ);
+extern void ebeno_fit_line(int count, double *points, double *line_equ, int *info);
+
+extern int ebeno_rectangle_insideness(double *corner1, double *corner2, double *point);
+extern int ebeno_rectangles_overlap(double *corner1, double *corner2, double *corner3, double *corner4);
+
+extern void ebeno_project_polygon_on_vector(int poly_size, double *polygon, double *vector, double *projection);
+extern int ebeno_convex_polygons_overlap(int size1, double *polygon1, int size2, double *polygon2);

File c/ebeno/convex_hull.h

View file
+extern void ebeno_monochain(int num_points, double *points,
+                            int task, int *hull_size, double *hull);
+extern void ebeno_convex_hull_line_intersect(int hull_size, double *hull,
+                                             double *line_equ,
+                                             double *intersections,
+                                             int *is_segment);
+extern void ebeno_convex_hull_xintercepts(int hull_size, double *hull,
+                                          double y, double *intercepts,
+                                          int *is_segment);
+extern void ebeno_convex_hull_yintercepts(int hull_size, double *hull,
+                                          double x, double *intercepts,
+                                          int *is_segment);
+extern int ebeno_convex_hull_insideness(int hull_size, double *hull,
+                                        double *point);
+extern int ebeno_convex_hulls_overlap(int hull1_size, double *hull1,
+                                      int hull2_size, double *hull2);

File c/ebeno/curve.h

View file
+extern void ebeno_convolve_np(int adegree, int bdegree, double *a, double *b, double *c);
+extern void ebeno_convolve_pa(int adegree, int bdegree, double *a, double *b, double *c);
+
+extern void ebeno_compose_be_np(int adegree, int bdegree, double *a, double *b, double *c);
+extern void ebeno_compose_be_pa(int adegree, int bdegree, double *a, double *b, double *c);
+extern void ebeno_compose_sb_np(int adegree, int bdegree, double *a, double *b, double *c);
+extern void ebeno_compose_sb_pa(int adegree, int bdegree, double *a, double *b, double *c);
+extern void ebeno_compose_mo_np(int adegree, int bdegree, double *a, double *b, double *c);
+extern void ebeno_compose_mo_pa(int adegree, int bdegree, double *a, double *b, double *c);
+extern void ebeno_compose_sr_np(int adegree, int bdegree, double *a, double *b, double *c);
+extern void ebeno_compose_sr_pa(int adegree, int bdegree, double *a, double *b, double *c);
+
+extern void ebeno_pow_be_np(int degree, double *b, int k, double *c);
+extern void ebeno_pow_be_pa(int degree, double *b, int k, double *c);
+extern void ebeno_pow_sb_np(int degree, double *b, int k, double *c);
+extern void ebeno_pow_sb_pa(int degree, double *b, int k, double *c);
+extern void ebeno_pow_mo_np(int degree, double *b, int k, double *c);
+extern void ebeno_pow_mo_pa(int degree, double *b, int k, double *c);
+extern void ebeno_pow_sr_np(int degree, double *b, int k, double *c);
+extern void ebeno_pow_sr_pa(int degree, double *b, int k, double *c);
+
+extern void ebeno_elev_be_np(int degree, double *b, int n, double *c);
+extern void ebeno_elev_be_pa(int degree, double *b, int n, double *c);
+extern void ebeno_elev_be_np_many(int degree, int count, double *b, int n, double *c);
+extern void ebeno_elev_be_pa_many(int degree, int count, double *b, int n, double *c);
+extern void ebeno_elev_sb_np(int degree, double *b, int n, double *c);
+extern void ebeno_elev_sb_pa(int degree, double *b, int n, double *c);
+extern void ebeno_elev_sb_np_many(int degree, int count, double *b, int n, double *c);
+extern void ebeno_elev_sb_pa_many(int degree, int count, double *b, int n, double *c);
+extern void ebeno_elev_mo_np(int degree, double *b, int n, double *c);
+extern void ebeno_elev_mo_pa(int degree, double *b, int n, double *c);
+extern void ebeno_elev_mo_np_many(int degree, int count, double *b, int n, double *c);
+extern void ebeno_elev_mo_pa_many(int degree, int count, double *b, int n, double *c);
+extern void ebeno_elev_sr_np(int degree, double *b, int n, double *c);
+extern void ebeno_elev_sr_pa(int degree, double *b, int n, double *c);
+extern void ebeno_elev_sr_np_many(int degree, int count, double *b, int n, double *c);
+extern void ebeno_elev_sr_pa_many(int degree, int count, double *b, int n, double *c);
+
+extern void ebeno_plus_be_np(int adegree, int bdegree, double *a, double *b, double *c);
+extern void ebeno_plus_be_pa(int adegree, int bdegree, double *a, double *b, double *c);
+extern void ebeno_plus_sb_np(int adegree, int bdegree, double *a, double *b, double *c);
+extern void ebeno_plus_sb_pa(int adegree, int bdegree, double *a, double *b, double *c);
+extern void ebeno_plus_mo_np(int adegree, int bdegree, double *a, double *b, double *c);
+extern void ebeno_plus_mo_pa(int adegree, int bdegree, double *a, double *b, double *c);
+extern void ebeno_plus_sr_np(int adegree, int bdegree, double *a, double *b, double *c);
+extern void ebeno_plus_sr_pa(int adegree, int bdegree, double *a, double *b, double *c);
+
+extern void ebeno_minus_be_np(int adegree, int bdegree, double *a, double *b, double *c);
+extern void ebeno_minus_be_pa(int adegree, int bdegree, double *a, double *b, double *c);
+extern void ebeno_minus_sb_np(int adegree, int bdegree, double *a, double *b, double *c);
+extern void ebeno_minus_sb_pa(int adegree, int bdegree, double *a, double *b, double *c);
+extern void ebeno_minus_mo_np(int adegree, int bdegree, double *a, double *b, double *c);
+extern void ebeno_minus_mo_pa(int adegree, int bdegree, double *a, double *b, double *c);
+extern void ebeno_minus_sr_np(int adegree, int bdegree, double *a, double *b, double *c);
+extern void ebeno_minus_sr_pa(int adegree, int bdegree, double *a, double *b, double *c);
+
+extern void ebeno_mul_be_np(int adegree, int bdegree, double *a, double *b, double *c);
+extern void ebeno_mul_be_pa(int adegree, int bdegree, double *a, double *b, double *c);
+extern void ebeno_mul_sr_np(int adegree, int bdegree, double *a, double *b, double *c);
+extern void ebeno_mul_sr_pa(int adegree, int bdegree, double *a, double *b, double *c);
+
+extern void ebeno_split_sr_np(int degree, double *b, double *c);
+extern void ebeno_split_sr_pa(int degree, double *b, double *c);
+extern void ebeno_unsplit_sr_np(int degree, double *c, double *b);
+extern void ebeno_unsplit_sr_pa(int degree, double *c, double *b);
+
+extern void ebeno_dropterms_mo_np(int degree, double *b, int n, double *c);
+extern void ebeno_dropterms_mo_pa(int degree, double *b, int n, double *c);
+extern void ebeno_dropterms_mo_np_many(int degree, int count, double *b, int n, double *c);
+extern void ebeno_dropterms_mo_pa_many(int degree, int count, double *b, int n, double *c);
+
+extern void ebeno_dropterms_sr_np(int degree, double *b, int n, double *c);
+extern void ebeno_dropterms_sr_pa(int degree, double *b, int n, double *c);
+extern void ebeno_dropterms_sr_np_many(int degree, int count, double *b, int n, double *c);
+extern void ebeno_dropterms_sr_pa_many(int degree, int count, double *b, int n, double *c);
+
+extern int ebeno_mindeg_be_np(int degree, double *b);
+extern int ebeno_mindeg_be_pa(int degree, double *b);
+extern int ebeno_mindeg_sb_np(int degree, double *b);
+extern int ebeno_mindeg_sb_pa(int degree, double *b);
+extern int ebeno_mindeg_mo_np(int degree, double *b);
+extern int ebeno_mindeg_mo_pa(int degree, double *b);
+extern int ebeno_mindeg_sr_np(int degree, double *b);
+extern int ebeno_mindeg_sr_pa(int degree, double *b);
+
+extern void ebeno_deriv_be_np(int degree, double *b, double *d);
+extern void ebeno_deriv_be_pa(int degree, double *b, double *d);
+extern void ebeno_deriv_be_np_many(int degree, int count, double *b, double *d);
+extern void ebeno_deriv_be_pa_many(int degree, int count, double *b, double *d);
+extern void ebeno_deriv_sb_np(int degree, double *b, double *d);
+extern void ebeno_deriv_sb_pa(int degree, double *b, double *d);
+extern void ebeno_deriv_sb_np_many(int degree, int count, double *b, double *d);
+extern void ebeno_deriv_sb_pa_many(int degree, int count, double *b, double *d);
+extern void ebeno_deriv_mo_np(int degree, double *b, double *d);
+extern void ebeno_deriv_mo_pa(int degree, double *b, double *d);
+extern void ebeno_deriv_mo_np_many(int degree, int count, double *b, double *d);
+extern void ebeno_deriv_mo_pa_many(int degree, int count, double *b, double *d);
+extern void ebeno_deriv_sr_np(int degree, double *b, double *d);
+extern void ebeno_deriv_sr_pa(int degree, double *b, double *d);
+extern void ebeno_deriv_sr_np_many(int degree, int count, double *b, double *d);
+extern void ebeno_deriv_sr_pa_many(int degree, int count, double *b, double *d);
+
+extern double ebeno_dir_be_np(int degree, double *b, double t);
+extern void ebeno_dir_be_pa(int degree, double *b, double t, double *dir);
+extern double ebeno_dir_sb_np(int degree, double *b, double t);
+extern void ebeno_dir_sb_pa(int degree, double *b, double t, double *dir);
+extern double ebeno_dir_mo_np(int degree, double *b, double t);
+extern void ebeno_dir_mo_pa(int degree, double *b, double t, double *dir);
+extern double ebeno_dir_sr_np(int degree, double *b, double t);
+extern void ebeno_dir_sr_pa(int degree, double *b, double t, double *dir);
+
+extern void ebeno_sb_of_be_np(int degree, double *b, double *c);
+extern void ebeno_sb_of_be_pa(int degree, double *b, double *c);
+extern void ebeno_be_of_sb_np(int degree, double *b, double *c);
+extern void ebeno_be_of_sb_pa(int degree, double *b, double *c);
+extern void ebeno_sb_of_be_np_many(int degree, int count, double *b, double *c);
+extern void ebeno_sb_of_be_pa_many(int degree, int count, double *b, double *c);
+extern void ebeno_be_of_sb_np_many(int degree, int count, double *b, double *c);
+extern void ebeno_be_of_sb_pa_many(int degree, int count, double *b, double *c);
+
+extern void ebeno_mo_of_be_np(int degree, double *b, double *c);
+extern void ebeno_mo_of_be_pa(int degree, double *b, double *c);
+extern void ebeno_be_of_mo_np(int degree, double *b, double *c);
+extern void ebeno_be_of_mo_pa(int degree, double *b, double *c);
+extern void ebeno_mo_of_be_np_many(int degree, int count, double *b, double *c);
+extern void ebeno_mo_of_be_pa_many(int degree, int count, double *b, double *c);
+extern void ebeno_be_of_mo_np_many(int degree, int count, double *b, double *c);
+extern void ebeno_be_of_mo_pa_many(int degree, int count, double *b, double *c);
+
+extern void ebeno_mo_of_sb_np(int degree, double *b, double *c);
+extern void ebeno_mo_of_sb_pa(int degree, double *b, double *c);
+extern void ebeno_sb_of_mo_np(int degree, double *b, double *c);
+extern void ebeno_sb_of_mo_pa(int degree, double *b, double *c);
+extern void ebeno_mo_of_sb_np_many(int degree, int count, double *b, double *c);
+extern void ebeno_mo_of_sb_pa_many(int degree, int count, double *b, double *c);
+extern void ebeno_sb_of_mo_np_many(int degree, int count, double *b, double *c);
+extern void ebeno_sb_of_mo_pa_many(int degree, int count, double *b, double *c);
+
+extern void ebeno_sr_of_be_np(int degree, double *b, double *c);
+extern void ebeno_sr_of_be_pa(int degree, double *b, double *c);
+extern void ebeno_be_of_sr_np(int degree, double *b, double *c);
+extern void ebeno_be_of_sr_pa(int degree, double *b, double *c);
+extern void ebeno_sr_of_be_np_many(int degree, int count, double *b, double *c);
+extern void ebeno_sr_of_be_pa_many(int degree, int count, double *b, double *c);
+extern void ebeno_be_of_sr_np_many(int degree, int count, double *b, double *c);
+extern void ebeno_be_of_sr_pa_many(int degree, int count, double *b, double *c);
+
+extern void ebeno_sr_of_sb_np(int degree, double *b, double *c);
+extern void ebeno_sr_of_sb_pa(int degree, double *b, double *c);
+extern void ebeno_sb_of_sr_np(int degree, double *b, double *c);
+extern void ebeno_sb_of_sr_pa(int degree, double *b, double *c);
+extern void ebeno_sr_of_sb_np_many(int degree, int count, double *b, double *c);
+extern void ebeno_sr_of_sb_pa_many(int degree, int count, double *b, double *c);
+extern void ebeno_sb_of_sr_np_many(int degree, int count, double *b, double *c);
+extern void ebeno_sb_of_sr_pa_many(int degree, int count, double *b, double *c);
+
+extern void ebeno_mo_of_sr_np(int degree, double *b, double *c);
+extern void ebeno_mo_of_sr_pa(int degree, double *b, double *c);
+extern void ebeno_sr_of_mo_np(int degree, double *b, double *c);
+extern void ebeno_sr_of_mo_pa(int degree, double *b, double *c);
+extern void ebeno_mo_of_sr_np_many(int degree, int count, double *b, double *c);
+extern void ebeno_mo_of_sr_pa_many(int degree, int count, double *b, double *c);
+extern void ebeno_sr_of_mo_np_many(int degree, int count, double *b, double *c);
+extern void ebeno_sr_of_mo_pa_many(int degree, int count, double *b, double *c);
+
+extern double ebeno_eval_be_np(int degree, double *b, double t);
+extern void ebeno_eval_be_pa(int degree, double *b, double t, double *v);
+extern double ebeno_eval_sb_np(int degree, double *b, double t);
+extern void ebeno_eval_sb_pa(int degree, double *b, double t, double *v);
+extern double ebeno_eval_mo_np(int degree, double *b, double t);
+extern void ebeno_eval_mo_pa(int degree, double *b, double t, double *v);
+extern double ebeno_eval_sr_np(int degree, double *b, double t);
+extern void ebeno_eval_sr_pa(int degree, double *b, double t, double *v);
+
+extern void ebeno_subdiv_be_np(int degree, double *b, double t, double *c);
+extern void ebeno_subdiv_sb_np(int degree, double *b, double t, double *c);
+extern void ebeno_subdiv_mo_np(int degree, double *b, double t, double *c);
+extern void ebeno_subdiv_sr_np(int degree, double *b, double t, double *c);
+extern void ebeno_subdiv_be_pa(int degree, double *b, double t, double *c);
+extern void ebeno_subdiv_sb_pa(int degree, double *b, double t, double *c);
+extern void ebeno_subdiv_mo_pa(int degree, double *b, double t, double *c);
+extern void ebeno_subdiv_sr_pa(int degree, double *b, double t, double *c);
+extern void ebeno_subdiv_be_np_many(int degree, int t_count, double *b, double *t, double *c);
+extern void ebeno_subdiv_sb_np_many(int degree, int t_count, double *b, double *t, double *c);
+extern void ebeno_subdiv_mo_np_many(int degree, int t_count, double *b, double *t, double *c);
+extern void ebeno_subdiv_sr_np_many(int degree, int t_count, double *b, double *t, double *c);
+extern void ebeno_subdiv_be_pa_many(int degree, int t_count, double *b, double *t, double *c);
+extern void ebeno_subdiv_sb_pa_many(int degree, int t_count, double *b, double *t, double *c);
+extern void ebeno_subdiv_mo_pa_many(int degree, int t_count, double *b, double *t, double *c);
+extern void ebeno_subdiv_sr_pa_many(int degree, int t_count, double *b, double *t, double *c);
+
+extern void ebeno_portion_be_np(int degree, double *b, double *t, double *c);
+extern void ebeno_portion_sb_np(int degree, double *b, double *t, double *c);
+extern void ebeno_portion_mo_np(int degree, double *b, double *t, double *c);
+extern void ebeno_portion_sr_np(int degree, double *b, double *t, double *c);
+extern void ebeno_portion_be_pa(int degree, double *b, double *t, double *c);
+extern void ebeno_portion_sb_pa(int degree, double *b, double *t, double *c);
+extern void ebeno_portion_mo_pa(int degree, double *b, double *t, double *c);
+extern void ebeno_portion_sr_pa(int degree, double *b, double *t, double *c);
+
+extern void ebeno_findroots_be_np(int degree, double *b, int *root_count, double *roots);
+extern void ebeno_findroots_sb_np(int degree, double *b, int *root_count, double *roots);
+extern void ebeno_findroots_sr_np(int degree, double *b, int *root_count, double *roots);
+
+extern void ebeno_inflections_be_np(int degree, double *b, int *time_count, double *times);
+extern void ebeno_inflections_be_pa(int degree, double *b, int *time_count, double *times);
+extern void ebeno_inflections_sb_np(int degree, double *b, int *time_count, double *times);
+extern void ebeno_inflections_sb_pa(int degree, double *b, int *time_count, double *times);
+extern void ebeno_inflections_sr_np(int degree, double *b, int *time_count, double *times);
+extern void ebeno_inflections_sr_pa(int degree, double *b, int *time_count, double *times);
+
+extern void ebeno_bounds_be_pa(int degree, double *b, double *bounds);
+extern void ebeno_bounds_be_pa_many(int degree, int count, double *b, double *bounds);
+
+extern int ebeno_excludexsect_be_pa_hulls(int adegree, int bdegree, double *a, double *b);
+extern int ebeno_excludexsect_be_pa_rects(int adegree, int bdegree, double *a, double *b);
+
+extern void ebeno_fatline_be_pa(int degree, double *b, double *line_equ, double *fatline);
+extern void ebeno_fatline_be_pa_along_endpt(int degree, double *b, double *fatline);
+extern void ebeno_fatline_be_pa_pair(int degree, double *b, double *fatlines);
+
+extern void ebeno_cliptimes_be_pa(int degree, double *b, double *fatline, double *times);
+extern void ebeno_cliptimes_be_pa_many(int degree, double *b, int fatline_count, double *fatlines, double *times);
+
+extern double ebeno_fatline_flatness(double *fatline);
+extern double ebeno_fatline_flatness_many(double *fatlines);
+
+extern void ebeno_intersect_be_pa(int adegree, int bdegree, double *a, double *b,
+                                  int max_times, int *time_count, double *atimes,
+                                  double *btimes, double *points);

File c/ga.c

View file
 double bvec2_double(const bvec2 *x) {
 	return 0.0;
 }
-void extractGrade_mvec3c(mvec3c *_dst, const mvec3c *a, int groupBitmap)
+void add_mvec2_mvec2(mvec2 *_dst, const mvec2 *a, const mvec2 *b)
 {
-	int aidx = 0, cidx = 0;
-	_dst->gu = a->gu & groupBitmap;
-	
-	if (a->gu & 1) {
-		if (groupBitmap & 1) {
-			copyGroup_0(a->c + aidx, _dst->c + cidx);
-			cidx += 1;
-		}
-		aidx += 1;
-	}
-	
-	if (a->gu & 2) {
-		if (groupBitmap & 2) {
-			copyGroup_1(a->c + aidx, _dst->c + cidx);
-			cidx += 5;
-		}
-		aidx += 5;
-	}
-	
-	if (a->gu & 4) {
-		if (groupBitmap & 4) {
-			copyGroup_2(a->c + aidx, _dst->c + cidx);
-			cidx += 10;
-		}
-		aidx += 10;
-	}
-	
-	if (a->gu & 8) {
-		if (groupBitmap & 8) {
-			copyGroup_3(a->c + aidx, _dst->c + cidx);
-			cidx += 10;
-		}
-		aidx += 10;
-	}
-	
-	if (a->gu & 16) {
-		if (groupBitmap & 16) {
-			copyGroup_4(a->c + aidx, _dst->c + cidx);
-			cidx += 5;
-		}
-		aidx += 5;
-	}
-	
-	if (a->gu & 32) {
-		if (groupBitmap & 32) {
-			copyGroup_5(a->c + aidx, _dst->c + cidx);
-		}
-	}
+	_dst->c[0] = (a->c[0]+b->c[0]);
+	_dst->c[1] = (a->c[1]+b->c[1]);
+	_dst->c[2] = (a->c[2]+b->c[2]);
+	_dst->c[3] = (a->c[3]+b->c[3]);
+
+}
+void add_vec2_vec2(vec2 *_dst, const vec2 *a, const vec2 *b)
+{
+	_dst->c[0] = (a->c[0]+b->c[0]);
+	_dst->c[1] = (a->c[1]+b->c[1]);
+
+}
+void add_mvec2_vec2(mvec2 *_dst, const mvec2 *a, const vec2 *b)
+{
+	_dst->c[0] = a->c[0];
+	_dst->c[1] = (a->c[1]+b->c[0]);
+	_dst->c[2] = (a->c[2]+b->c[1]);
+	_dst->c[3] = a->c[3];
+
+}
+void add_vec2_mvec2(mvec2 *_dst, const vec2 *a, const mvec2 *b)
+{
+	_dst->c[0] = b->c[0];
+	_dst->c[1] = (a->c[0]+b->c[1]);
+	_dst->c[2] = (a->c[1]+b->c[2]);
+	_dst->c[3] = b->c[3];
+
+}
+void subtract_mvec2_mvec2(mvec2 *_dst, const mvec2 *a, const mvec2 *b)
+{
+	_dst->c[0] = (a->c[0]-b->c[0]);
+	_dst->c[1] = (a->c[1]-b->c[1]);
+	_dst->c[2] = (a->c[2]-b->c[2]);
+	_dst->c[3] = (a->c[3]-b->c[3]);
+
+}
+void subtract_vec2_vec2(vec2 *_dst, const vec2 *a, const vec2 *b)
+{
+	_dst->c[0] = (a->c[0]-b->c[0]);
+	_dst->c[1] = (a->c[1]-b->c[1]);
+
+}
+void subtract_mvec2_vec2(mvec2 *_dst, const mvec2 *a, const vec2 *b)
+{
+	_dst->c[0] = a->c[0];
+	_dst->c[1] = (a->c[1]-b->c[0]);
+	_dst->c[2] = (a->c[2]-b->c[1]);
+	_dst->c[3] = a->c[3];
+
+}
+void subtract_vec2_mvec2(mvec2 *_dst, const vec2 *a, const mvec2 *b)
+{
+	_dst->c[0] = -b->c[0];
+	_dst->c[1] = (a->c[0]-b->c[1]);
+	_dst->c[2] = (a->c[1]-b->c[2]);
+	_dst->c[3] = -b->c[3];
+
 }
 void gp_mvec3c_mvec3c(mvec3c *_dst, const mvec3c *a, const mvec3c *b)
 {
 	}
 	compress(c, _dst->c, &(_dst->gu), 0.0, 63);
 }
+void gp_mvec2_mvec2(mvec2 *_dst, const mvec2 *a, const mvec2 *b)
+{
+	_dst->c[0] = (a->c[0]*b->c[0]+a->c[1]*b->c[1]+a->c[2]*b->c[2]-a->c[3]*b->c[3]);
+	_dst->c[1] = (a->c[0]*b->c[1]+a->c[1]*b->c[0]-a->c[2]*b->c[3]+a->c[3]*b->c[2]);
+	_dst->c[2] = (a->c[0]*b->c[2]+a->c[1]*b->c[3]+a->c[2]*b->c[0]-a->c[3]*b->c[1]);
+	_dst->c[3] = (a->c[0]*b->c[3]+a->c[1]*b->c[2]-a->c[2]*b->c[1]+a->c[3]*b->c[0]);
+
+}
+void gp_vec2_vec2(mvec2 *_dst, const vec2 *a, const vec2 *b)
+{
+	_dst->c[0] = (a->c[0]*b->c[0]+a->c[1]*b->c[1]);
+	_dst->c[1] = _dst->c[2] = 0.0;
+	_dst->c[3] = (a->c[0]*b->c[1]-a->c[1]*b->c[0]);
+
+}
+void extractGrade_mvec3c(mvec3c *_dst, const mvec3c *a, int groupBitmap)
+{
+	int aidx = 0, cidx = 0;
+	_dst->gu = a->gu & groupBitmap;
+	
+	if (a->gu & 1) {
+		if (groupBitmap & 1) {
+			copyGroup_0(a->c + aidx, _dst->c + cidx);
+			cidx += 1;
+		}
+		aidx += 1;
+	}
+	
+	if (a->gu & 2) {
+		if (groupBitmap & 2) {
+			copyGroup_1(a->c + aidx, _dst->c + cidx);
+			cidx += 5;
+		}
+		aidx += 5;
+	}
+	
+	if (a->gu & 4) {
+		if (groupBitmap & 4) {
+			copyGroup_2(a->c + aidx, _dst->c + cidx);
+			cidx += 10;
+		}
+		aidx += 10;
+	}
+	
+	if (a->gu & 8) {
+		if (groupBitmap & 8) {
+			copyGroup_3(a->c + aidx, _dst->c + cidx);
+			cidx += 10;
+		}
+		aidx += 10;
+	}
+	
+	if (a->gu & 16) {
+		if (groupBitmap & 16) {
+			copyGroup_4(a->c + aidx, _dst->c + cidx);
+			cidx += 5;
+		}
+		aidx += 5;
+	}
+	
+	if (a->gu & 32) {
+		if (groupBitmap & 32) {
+			copyGroup_5(a->c + aidx, _dst->c + cidx);
+		}
+	}
+}
 double norm2_mvec3c(const mvec3c *a)
 {
 	double n2 = 0.0;
 		copyDiv_5(a->c + idx, _dst->c + idx, n2);
 	}
 }
-void add_mvec2_mvec2(mvec2 *_dst, const mvec2 *a, const mvec2 *b)
-{
-	_dst->c[0] = (a->c[0]+b->c[0]);
-	_dst->c[1] = (a->c[1]+b->c[1]);
-	_dst->c[2] = (a->c[2]+b->c[2]);
-	_dst->c[3] = (a->c[3]+b->c[3]);
-
-}
 void applyUnitVersor_mvec2_mvec2(mvec2 *_dst, const mvec2 *a, const mvec2 *b)
 {
 	_dst->c[0] = (a->c[0]*a->c[0]*b->c[0]+2.0*a->c[0]*a->c[1]*b->c[1]+2.0*a->c[0]*a->c[2]*b->c[2]+a->c[1]*a->c[1]*b->c[0]+2.0*a->c[1]*a->c[3]*b->c[2]+a->c[2]*a->c[2]*b->c[0]+-2.0*a->c[2]*a->c[3]*b->c[1]+a->c[3]*a->c[3]*b->c[0]);
 	_dst->c[0] = a->c[3];
 
 }
-void gp_mvec2_mvec2(mvec2 *_dst, const mvec2 *a, const mvec2 *b)
-{
-	_dst->c[0] = (a->c[0]*b->c[0]+a->c[1]*b->c[1]+a->c[2]*b->c[2]-a->c[3]*b->c[3]);
-	_dst->c[1] = (a->c[0]*b->c[1]+a->c[1]*b->c[0]-a->c[2]*b->c[3]+a->c[3]*b->c[2]);
-	_dst->c[2] = (a->c[0]*b->c[2]+a->c[1]*b->c[3]+a->c[2]*b->c[0]-a->c[3]*b->c[1]);
-	_dst->c[3] = (a->c[0]*b->c[3]+a->c[1]*b->c[2]-a->c[2]*b->c[1]+a->c[3]*b->c[0]);
-
-}
 double norm2_mvec2(const mvec2 *a)
 {
 	return (a->c[0]*a->c[0]+a->c[1]*a->c[1]+a->c[2]*a->c[2]+a->c[3]*a->c[3]);
 	_dst->c[3] = -a->c[3];
 
 }
-void subtract_mvec2_mvec2(mvec2 *_dst, const mvec2 *a, const mvec2 *b)
-{
-	_dst->c[0] = (a->c[0]-b->c[0]);
-	_dst->c[1] = (a->c[1]-b->c[1]);
-	_dst->c[2] = (a->c[2]-b->c[2]);
-	_dst->c[3] = (a->c[3]-b->c[3]);
-
-}
 void versorInverse_mvec2(mvec2 *_dst, const mvec2 *a)
 {
 	double _n2_ = (a->c[0]*a->c[0]+a->c[1]*a->c[1]+a->c[2]*a->c[2]+a->c[3]*a->c[3]);
 	_dst->c[3] = -a->c[3]/((_n2_));
 
 }
-void add_vec2_vec2(vec2 *_dst, const vec2 *a, const vec2 *b)
-{
-	_dst->c[0] = (a->c[0]+b->c[0]);
-	_dst->c[1] = (a->c[1]+b->c[1]);
-
-}

File c/ga.h

View file
 /** Returns scalar part of  bvec2 */
 double bvec2_double(const bvec2 *x);
 /**
- * Returns grade groupBitmap of  mvec3c.
+ * Returns mvec2 + mvec2.
  */
-void extractGrade_mvec3c(mvec3c *_dst, const mvec3c *a, int groupBitmap);
+void add_mvec2_mvec2(mvec2 *_dst, const mvec2 *a, const mvec2 *b);
+/**
+ * Returns vec2 + vec2.
+ */
+void add_vec2_vec2(vec2 *_dst, const vec2 *a, const vec2 *b);
+/**
+ * Returns mvec2 + vec2.
+ */
+void add_mvec2_vec2(mvec2 *_dst, const mvec2 *a, const vec2 *b);
+/**
+ * Returns vec2 + mvec2.
+ */
+void add_vec2_mvec2(mvec2 *_dst, const vec2 *a, const mvec2 *b);
+/**
+ * Returns mvec2 - mvec2.
+ */
+void subtract_mvec2_mvec2(mvec2 *_dst, const mvec2 *a, const mvec2 *b);
+/**
+ * Returns vec2 - vec2.
+ */
+void subtract_vec2_vec2(vec2 *_dst, const vec2 *a, const vec2 *b);
+/**
+ * Returns mvec2 - vec2.
+ */
+void subtract_mvec2_vec2(mvec2 *_dst, const mvec2 *a, const vec2 *b);
+/**
+ * Returns vec2 - mvec2.
+ */
+void subtract_vec2_mvec2(mvec2 *_dst, const vec2 *a, const mvec2 *b);
 /**
  * Returns geometric product of mvec3c and mvec3c.
  */
 void gp_mvec3c_mvec3c(mvec3c *_dst, const mvec3c *a, const mvec3c *b);
 /**
+ * Returns geometric product of mvec2 and mvec2.
+ */
+void gp_mvec2_mvec2(mvec2 *_dst, const mvec2 *a, const mvec2 *b);
+/**
+ * Returns geometric product of vec2 and vec2.
+ */
+void gp_vec2_vec2(mvec2 *_dst, const vec2 *a, const vec2 *b);
+/**
+ * Returns grade groupBitmap of  mvec3c.
+ */
+void extractGrade_mvec3c(mvec3c *_dst, const mvec3c *a, int groupBitmap);
+/**
  * Returns norm2 of mvec3c using default metric.
  */
 double norm2_mvec3c(const mvec3c *a);
  */
 void versorInverse_mvec3c(mvec3c *_dst, const mvec3c *a);
 /**
- * Returns mvec2 + mvec2.
- */
-void add_mvec2_mvec2(mvec2 *_dst, const mvec2 *a, const mvec2 *b);
-/**
  * Returns a * b * reverse(a) using default metric. Only gives the correct result when the versor has a positive squared norm.
  * 
  */
  */
 void extractGrade2_mvec2(bvec2 *_dst, const mvec2 *a);
 /**
- * Returns geometric product of mvec2 and mvec2.
- */
-void gp_mvec2_mvec2(mvec2 *_dst, const mvec2 *a, const mvec2 *b);
-/**
  * Returns norm2 of mvec2 using default metric.
  */
 double norm2_mvec2(const mvec2 *a);
  */
 void reverse_mvec2(mvec2 *_dst, const mvec2 *a);
 /**
- * Returns mvec2 - mvec2.
- */
-void subtract_mvec2_mvec2(mvec2 *_dst, const mvec2 *a, const mvec2 *b);
-/**
  * Returns versor inverse of a using default metric.
  */
 void versorInverse_mvec2(mvec2 *_dst, const mvec2 *a);
-/**
- * Returns vec2 + vec2.
- */
-void add_vec2_vec2(vec2 *_dst, const vec2 *a, const vec2 *b);
 #endif /* _GA_H_ */

File c/ga.xml

View file
   <!-- Plane euclidean bivector. -->
   <smv name="bvec2" type="blade"> e1^e2 </smv>
 
+  <function name="add" arg1="mvec2" arg2="mvec2"/>
+  <function name="add" arg1="vec2" arg2="vec2"/>
+  <function name="add" arg1="mvec2" arg2="vec2"/>
+  <function name="add" arg1="vec2" arg2="mvec2"/>
+
+  <function name="subtract" arg1="mvec2" arg2="mvec2"/>
+  <function name="subtract" arg1="vec2" arg2="vec2"/>
+  <function name="subtract" arg1="mvec2" arg2="vec2"/>
+  <function name="subtract" arg1="vec2" arg2="mvec2"/>
+
+  <function name="gp" arg1="mvec3c" arg2="mvec3c"/>
+  <function name="gp" arg1="mvec2" arg2="mvec2"/>
+  <function name="gp" arg1="vec2" arg2="vec2"/>
+
   <function name="extractGrade" arg1="mvec3c"/>
-  <function name="gp" arg1="mvec3c" arg2="mvec3c"/>
   <function name="norm2" arg1="mvec3c"/>
   <function name="reverse" arg1="mvec3c"/>
   <function name="versorInverse" arg1="mvec3c"/>
 
-  <function name="add" arg1="mvec2" arg2="mvec2"/>
   <function name="applyUnitVersor" arg1="mvec2" arg2="mvec2"/>
   <function name="applyVersor" arg1="mvec2" arg2="mvec2"/>
   <function name="applyVersorWI" arg1="mvec2" arg2="mvec2" arg3="mvec2"/>
   <function name="extractGrade0" arg1="mvec2"/>
   <function name="extractGrade1" arg1="mvec2"/>
   <function name="extractGrade2" arg1="mvec2"/>
-  <function name="gp" arg1="mvec2" arg2="mvec2"/>
   <function name="norm2" arg1="mvec2"/>
   <function name="reverse" arg1="mvec2"/>
-  <function name="subtract" arg1="mvec2" arg2="mvec2"/>
   <!-- <function name="undual" arg1="mvec2"/> -->
   <function name="versorInverse" arg1="mvec2"/>
 
-  <function name="add" arg1="vec2" arg2="vec2"/>
-
 </g25spec>

File c/geometric_algebra.h

-extern void ebeno_mvec2_of_scalar(double *c, double r);
-extern double ebeno_mvec2_scalar_coord(double *c);
-extern double ebeno_mvec2_e1_coord(double *c);
-extern double ebeno_mvec2_e2_coord(double *c);
-extern double ebeno_mvec2_e1_e2_coord(double *c);
-extern void ebeno_mvec2_with_scalar(double *c, double r);
-extern void ebeno_add_mvec2_mvec2(double *c_out, double *c1, double *c2);
-extern void ebeno_subtract_mvec2_mvec2(double *c_out, double *c1, double *c2);
-extern void ebeno_gp_mvec2_mvec2(double *c_out, double *c1, double *c2);

File pure/ebeno/geometric_algebra.pure

View file
 //
 
 using ebeno::geometric_algebra_h;
-using gsl;
 using math;
 
 namespace ebeno;
     _ = throw (bad_multivector_grade grade mv);
   end;
 
-// Sum of multivectors.
-mv1::mvec2 ::+ mv2::mvec2 =
-  case mv1, mv2 of
-    mvec2 c1, mvec2 c2 = mvec2 (c1 + c2);
+// Sums.
+mvec2 {a0,a1,a2,a3} ::+ mvec2 {b0,b1,b2,b3} =
+  mvec2 {a0 + b0, a1 + b1, a2 + b2, a3 + b3};
+vec2 {a0,a1} ::+ vec2 {b0,b1} =
+  vec2 {a0 + b0, a1 + b1};
+mvec2 {a0,a1,a2,a3} ::+ vec2 {b1,b2} =
+  mvec2 {a0, a1 + b1, a2 + b2, a3};
+vec2 {a1,a2} ::+ mvec2 {b0,b1,b2,b3} =
+  mvec2 {b0, a1 + b1, a2 + b2, b3};
+
+// Differences
+mvec2 {a0,a1,a2,a3} ::- mvec2 {b0,b1,b2,b3} =
+  mvec2 {a0 - b0, a1 - b1, a2 - b2, a3 - b3};
+vec2 {a0,a1} ::- vec2 {b0,b1} =
+  vec2 {a0 - b0, a1 - b1};
+mvec2 {a0,a1,a2,a3} ::- vec2 {b1,b2} =
+  mvec2 {a0, a1 - b1, a2 - b2, a3};
+vec2 {a1,a2} ::- mvec2 {b0,b1,b2,b3} =
+  mvec2 {b0, a1 - b1, a2 - b2, b3};
+
+// Geometric products.
+mvec2 c1::dmatrix ::* mvec2 c2::dmatrix = mvec2 c
+  when
+    c::dmatrix = rowvector $ repeatn 4 0.0;
+    cp1::dmatrix = pack c1;
+    cp2::dmatrix = pack c2;
+    gp_mvec2_mvec2 (pointer c, pointer cp1, pointer cp2);
   end;
-
-// Difference of multivectors.
-mv1::mvec2 ::- mv2::mvec2 =
-  case mv1, mv2 of
-    mvec2 c1, mvec2 c2 = mvec2 (c1 - c2);
+mvec2 {a0,a1,a2,a3} ::* mvec2 {b0,b1,b2,b3} =
+  mvec2 {a0*b0 + a1*b1 + a2*b2 - a3*b3,
+         a0*b1 + a1*b0 - a2*b3 + a3*b2,
+         a0*b2 + a1*b3 + a2*b0 - a3*b1,
+         a0*b3 + a1*b2 - a2*b1 + a3*b0};
+vec2 c1::dmatrix ::* vec2 c2::dmatrix = mvec2 c
+  when
+    c::dmatrix = rowvector $ repeatn 4 0.0;
+    cp1::dmatrix = pack c1;
+    cp2::dmatrix = pack c2;
+    gp_vec2_vec2 (pointer c, pointer cp1, pointer cp2);
   end;
-
-// Geometric product of multivectors.
-mv1::mvec2 ::* mv2::mvec2 =
-  case mv1, mv2 of
-    mvec2 c1::dmatrix, mvec2 c2::dmatrix = mvec2 c
-      when
-        c::dmatrix = pack c1;
-        ebeno_gp_mvec2_mvec2 c c (pack c2);
-      end;
-    mvec2 {a0,a1,a2,a3}, mvec2 {b0,b1,b2,b3} =
-      {a0*b0 + a1*b1 + a2*b2 - a3*b3,
-       a0*b1 + a1*b0 - a2*b3 + a3*b2,
-       a0*b2 + a1*b3 + a2*b0 - a3*b1,
-       a0*b3 + a1*b2 - a2*b1 + a3*b0};
-  end;
+vec2 {a0,a1} ::* vec2 {b0,b1} =
+  mvec2 {a0*b0 + a1*b1, 0, 0, a0*b1 - a1*b0};
 
 //-------------------------------------------------------------------------
 
 /*
-nonfix Vec BVec MVec;
-
-type vec (Vec M::imatrix) = dim M == (1,2);
-type vec (Vec M::dmatrix) = dim M == (1,2);
-type vec (Vec {e1::real, e2::real});
-
-type bivec (BVec M::imatrix) = dim M == (1,1);
-type bivec (BVec M::dmatrix) = dim M == (1,1);
-type bivec (BVec {I::real});
-
-type multivec a::real;
-type multivec u::vec;
-type multivec B::bivec;
-type multivec (MVec M::imatrix) = dim M == (1,4);
-type multivec (MVec M::dmatrix) = dim M == (1,4);
-type multivec (MVec {a::real, e1::real, e2::real, I::real});
-
-const e1 = Vec {1,0};
-const e2 = Vec {0,1};
-const I  = BVec {1};
-
 infix (*) ⋀ :^: ; // Outer product.
 infix (*) ⋅ :.: ; // Dot product.
 (:^:) = (⋀);
 (:.:) = (⋅);
-
-a::real ::* Vec {u1,u2} | Vec {u1,u2} ::* a::real = Vec {a*u1,a*u2};
-Vec {u1,u2} ::/ a::real = Vec {u1/a,u2/a};
-Vec {u1,u2} ::+ Vec {v1,v2} = Vec {u1 + v1, u2 + v2};
-Vec {u1,u2} ::- Vec {v1,v2} = Vec {u1 - v1, u2 - v2};
-Vec {u1,u2} ::.* Vec {v1,v2} = Vec {u1 * v1, u2 * v2};
-Vec {u1,u2} ::./ Vec {v1,v2} = Vec {u1/v1, u2/v2};
-Vec {u1,u2} ⋅ Vec {v1,v2} = u1*v1 + u2*v2;
-Vec {u1,u2} ⋀ Vec {v1,v2} = BVec {u1*v2 - u2*v1};
-
-a::real ::* BVec {u1,u2} | BVec {u1,u2} ::* a::real = BVec {a*u1,a*u2};
-BVec {b} ::+ BVec {c} = BVec {b + c};
-BVec {b} ::- BVec {c} = BVec {b - c};
-
-MVec {a1,u1,v1,b1} * MVec {a2,u2,v2,b2} =
-  MVec {a1*a2 + u1*u2 + v1*v2 - b1*b2,
-        a1*u2 + a2*u1 - v1*b2 - v2*b1,
-        a1*v2 + a2*v1 + u1*b2 + u2*b1,
-        a1*b2 + a2*b1 + u1*v2 - u2*v1};
 */