Back to index

texmacs  1.0.7.15
Public Member Functions | Public Attributes
arc_rep Struct Reference
Inheritance diagram for arc_rep:
Inheritance graph
[legend]
Collaboration diagram for arc_rep:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 arc_rep (array< point > a, array< path > cip, bool close)
point evaluate (double t)
void rectify_cumul (array< point > &cum, double eps)
double bound (double t, double eps)
point grad (double t, bool &error)
double curvature (double t1, double t2)
int get_control_points (array< double > &abs, array< point > &pts, array< path > &cip)
virtual int nr_components ()
array< pointrectify (double eps)
virtual array< double > find_closest_points (double t1, double t2, point p, double eps)
virtual double find_closest_point (double t1, double t2, point p, double eps, bool &found)

Public Attributes

array< pointa
array< pathcip
array< double > u
point center
point i
point j
double r1
double r2
double e1
double e2
int ref_count

Detailed Description

Definition at line 678 of file curve.cpp.


Constructor & Destructor Documentation

arc_rep::arc_rep ( array< point a,
array< path cip,
bool  close 
)

Definition at line 696 of file curve.cpp.

                                                              :
  a(a2), cip(cip2)
{
  int n= N(a);
  point o1= (n>0 ? a[0] : point (0,0));
  point o2= (n>1 ? a[1] : point (0,0));
  point o3= (n>2 ? a[2] : point (0,0));
  if (n!=3 || linearly_dependent (o1, o2, o3) ||
     (N (center= intersection (midperp (o1, o2, o3),
                            midperp (o2, o3, o1))) == 0))
  {
    center= i= j= 0*o1;
    r1= r2= 1;
    e1= 0;
    e2= 1;
    a= array<point> (1);
    a[0]= o1;
    if (N(cip)) {
      path p= cip[0];
      cip= array<path> (1);
      cip[0]= p;
    }
    u= array<double> (1);
    u[0]= 0;
    return;
  }
  r1= r2= norm (o1-center);
  if (orthogonalize (i, j, center, o1, o2)) ;
  else
    orthogonalize (i, j, center, o1, o3);
  e1= 0;
  point o2b (2), o3b (2);
  o2b[0]= (o2-center) * i;
  o2b[1]= (o2-center) * j;
  o3b[0]= (o3-center) * i;
  o3b[1]= (o3-center) * j;
  e2= arg (o3b) / (2*tm_PI);
  double e3= arg (o2b) / (2*tm_PI);
  if (e2<e3) {
    j= -j;
    o3b[1]= -o3b[1];
    e2= arg (o3b) / (2*tm_PI);
    o2b[1]= -o2b[1];
    e3= arg (o2b) / (2*tm_PI);
  }
  u= array<double> (3);
  u[0]= 0;
  u[1]= e3;
  u[2]= e2;
  if (close) e2= 1.0;
}

Here is the call graph for this function:


Member Function Documentation

double arc_rep::bound ( double  t,
double  eps 
) [virtual]

Implements curve_rep.

Definition at line 766 of file curve.cpp.

                                    {
  return curve_rep::bound (t, eps);
}
double arc_rep::curvature ( double  t1,
double  t2 
) [virtual]

Implements curve_rep.

Definition at line 779 of file curve.cpp.

                                        {
  (void) t1; (void) t2;
  if (r1 >= r2)
    return fnull (r1,1.0e-6) ? tm_infinity : square(r2)/r1;
  else
    return fnull (r2,1.0e-6) ? tm_infinity : square(r1)/r2;
}

Here is the call graph for this function:

point arc_rep::evaluate ( double  t) [virtual]

Implements curve_rep.

Definition at line 749 of file curve.cpp.

                           {
  t= e1 + t*(e2 - e1);
  return center + r1*cos(2*tm_PI*t)*i
                + r2*sin(2*tm_PI*t)*j;
}

Here is the call graph for this function:

Here is the caller graph for this function:

double curve_rep::find_closest_point ( double  t1,
double  t2,
point  p,
double  eps,
bool &  found 
) [virtual, inherited]

Definition at line 138 of file curve.cpp.

{
  array<double> res= find_closest_points (t1, t2, p, eps);
  found= N(res)>0;
  if (found)
    return res[0];
  else
    return -1;
}

Here is the call graph for this function:

array< double > curve_rep::find_closest_points ( double  t1,
double  t2,
point  p,
double  eps 
) [virtual, inherited]

Definition at line 125 of file curve.cpp.

{
  array<curvet> res= curvet_closest_points (curve (this), t1, t2, p, eps);
  merge_sort_leq <curvet, less_eq_curvet> (res);
  array<double> rest= array<double> (N(res));
  int i;
  for (i=0; i<N(res); i++)
    rest[i]= res[i].t;
  return rest;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int arc_rep::get_control_points ( array< double > &  abs,
array< point > &  pts,
array< path > &  cip 
) [virtual]

Reimplemented from curve_rep.

Definition at line 793 of file curve.cpp.

{
  abs = u;
  pts = a;
  rcip= cip;
  return N(a);
}

Here is the call graph for this function:

point arc_rep::grad ( double  t,
bool &  error 
) [virtual]

Implements curve_rep.

Definition at line 771 of file curve.cpp.

                                    {
  error= false;
  t= e1 + t*(e2 - e1);
  return -2*tm_PI*r1*sin(2*tm_PI*t)*i
         +2*tm_PI*r2*cos(2*tm_PI*t)*j;
}

Here is the call graph for this function:

virtual int curve_rep::nr_components ( ) [inline, virtual, inherited]

Reimplemented in transformed_curve_rep, inverted_curve_rep, compound_curve_rep, and poly_segment_rep.

Definition at line 21 of file curve.hpp.

{ return 1; }
array< point > curve_rep::rectify ( double  eps) [inherited]

Definition at line 25 of file curve.cpp.

                              {
  array<point> a (1);
  a[0]= evaluate (0.0);
  rectify_cumul (a, eps);
  return a;
}

Here is the call graph for this function:

void arc_rep::rectify_cumul ( array< point > &  cum,
double  eps 
) [virtual]

Implements curve_rep.

Definition at line 756 of file curve.cpp.

                                                     {
  double t, step;
  step= sqrt (2*eps / max (r1, r2) ) / tm_PI;
  for (t=step; t<=1.0; t+=step)
    cum << evaluate (t);
  if (t-step != 1.0)
    cum << evaluate (1.0);
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 679 of file curve.cpp.

Definition at line 682 of file curve.cpp.

Definition at line 680 of file curve.cpp.

double arc_rep::e1

Definition at line 685 of file curve.cpp.

double arc_rep::e2

Definition at line 685 of file curve.cpp.

Definition at line 683 of file curve.cpp.

Definition at line 683 of file curve.cpp.

double arc_rep::r1

Definition at line 684 of file curve.cpp.

double arc_rep::r2

Definition at line 684 of file curve.cpp.

int abstract_struct::ref_count [inherited]

Definition at line 142 of file basic.hpp.

array<double> arc_rep::u

Definition at line 681 of file curve.cpp.


The documentation for this struct was generated from the following file: