degate  0.1.2
Functions
TangencyCheck.cc File Reference
#include <degate.h>
#include <TangencyCheck.h>

Go to the source code of this file.

Functions

bool get_line_function_for_wire (degate::Line_shptr l, double *m, double *n)
 Calculate the parameter for a linear function f(x) = m*x + n.

Function Documentation

bool get_line_function_for_wire ( degate::Line_shptr  l,
double *  m,
double *  n 
)

Calculate the parameter for a linear function f(x) = m*x + n.

Returns:
Returns if the parameter can be calculated.

Definition at line 29 of file TangencyCheck.cc.

Referenced by degate::check_object_tangency().

                                                                            {
  assert(l != NULL);
  assert(m != NULL);
  assert(n != NULL);

  int d_y = l->get_to_y() - l->get_from_y();
  int d_x = l->get_to_x() - l->get_from_x();

  if(abs(d_x) == 0) return false;
  else {
    *m = static_cast<double>(d_y) / static_cast<double>(d_x);
    *n = l->get_from_y() - l->get_from_x() * *m;
    return true;
  }
}

Here is the caller graph for this function: