Back to index

texmacs  1.0.7.15
Classes | Functions
curve.hpp File Reference
#include "point.hpp"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  curve_rep
class  curve

Functions

 ABSTRACT_NULL_CODE (curve)
curve segment (point p1, point p2)
curve poly_segment (array< point > a, array< path > cip)
curve spline (array< point > a, array< path > cip, bool close=false, bool interpol=true)
curve arc (array< point > a, array< path > cip, bool close=false)
curve operator* (curve c1, curve c2)
curve invert (curve c)
array< pointintersection (curve f, curve g, point p0, double eps)
point closest (curve f, point p)

Function Documentation

curve arc ( array< point a,
array< path cip,
bool  close = false 
)

Definition at line 788 of file curve.cpp.

                                                  {
  return tm_new<arc_rep> (a, cip, close);
}

Here is the caller graph for this function:

point closest ( curve  f,
point  p 
)

Definition at line 150 of file curve.cpp.

                           {
  array<double> abs;
  array<point> pts;
  array<path> rcip;
  f->get_control_points (abs, pts, rcip);
  if (N(abs) == 0) return f(0);
  double t1= abs[0];
  double t2= abs[N(abs)-1];
  double best= 0;
  double eps = norm (f(0) - p);
  for (int i=0; i<10; i++) {
    bool found= false;
    double t= f->find_closest_point (t1, t2, p, eps, found);
    if (found) best= t;
    else break;
    double eps2= norm (f(t) - p);
    if (eps2 >= 0.9 * eps) break;
    eps= eps2;
  }
  return f(best);
}

Here is the call graph for this function:

Here is the caller graph for this function:

array<point> intersection ( curve  f,
curve  g,
point  p0,
double  eps 
)

Definition at line 202 of file curve.cpp.

                                                      {
  // For local intersections only
  array<point> res;
  if (is_nil (f) || is_nil (g)) return res;
  bool found= false;
  double d1, d2;
  if (f==g) {
    array<double> pts= f->find_closest_points (0.0, 1.0, p0, eps);
    if (N(pts)>=2) {
      d1= pts[0];
      d2= pts[1];
      found= intersection (f, f, d1, d2);
    }
  }
  else {
    bool res1, res2;
    d1= f->find_closest_point (0.0, 1.0, p0, eps, res1);
    d2= g->find_closest_point (0.0, 1.0, p0, eps, res2);
    if (res1 && res2)
      found= intersection (f, g, d1, d2);
  }
  if (found)
    res << f (d1);
  return res;
}

Here is the call graph for this function:

curve invert ( curve  c)

Definition at line 883 of file curve.cpp.

                 {
  return tm_new<inverted_curve_rep> (c);
}
curve operator* ( curve  c1,
curve  c2 
)

Definition at line 837 of file curve.cpp.

                                {
  // FIXME: we might want to test whether c1(1.0) is approx equal to c2(0.0)
  return tm_new<compound_curve_rep> (c1, c2);
}
curve poly_segment ( array< point a,
array< path cip 
)

Definition at line 328 of file curve.cpp.

                                               {
  return tm_new<poly_segment_rep> (a, cip);
}

Here is the caller graph for this function:

curve segment ( point  p1,
point  p2 
)

Definition at line 273 of file curve.cpp.

                             {
  return tm_new<segment_rep> (p1, p2);
}

Here is the caller graph for this function:

curve spline ( array< point a,
array< path cip,
bool  close = false,
bool  interpol = true 
)

Definition at line 670 of file curve.cpp.

                                                                    {
  return tm_new<spline_rep> (a, cip, close, interpol);
}

Here is the caller graph for this function: