Exemple #1
0
	vt length() const {
		vt len = 0.0;
		len = sqrt(
				double(
						(psx() - pex()) * (psx() - pex())
								+ (psy() - pey()) * (psy() - pey())));
		return len;
	}
Exemple #2
0
	void transfer(vt dx, vt dy, vt dz = 0.0) {
		if (!empty()) {
			psx() = psx() + dx;
			psy() = psy() + dy;
			pex() = pex() + dx;
			pey() = pey() + dy;
		}
		if (Dim == 3) {
			psz() = psz() + dz;
			pez() = pez() + dz;
		}
	}
Exemple #3
0
	bool is_in_box(const Point_<TYPE, DIM> &pt) const {
		ASSERT(!empty());
		if (is_horizontal()) {
			return (((psx() <= pt.x) && (pt.x <= pex()))
					|| ((pex() <= pt.x) && (pt.x <= psx())));
		}
		if (is_vertical()) {
			return (((psy() <= pt.y) && (pt.y <= pey()))
					|| ((pey() <= pt.y) && (pt.y <= psy())));
		}
		return (((psx() <= pt.x) && (pt.x <= pex()))
				|| ((pex() <= pt.x) && (pt.x <= psx())))
				&& (((psy() <= pt.y) && (pt.y <= pey()))
						|| ((pey() <= pt.y) && (pt.y <= psy())));
	}
Exemple #4
0
	void scale(vt xfactor, vt yfactor, vt zfactor = 1) {
		this->ps().x() = psx() * xfactor;
		this->ps().y() = psy() * yfactor;
		if (Dim == 3) {
			psz() = psz() * zfactor;
		}
		pex() = pex() * xfactor;
		pey() = pey() * yfactor;
		if (Dim == 3) {
			pez() = pez() * zfactor;
		}
		if (pe() == ps()) {
			_set_empty();
		}
	}
Exemple #5
0
	bool empty() const {
		if (psx() == 0.0 && psy() == 0.0 && pex() == 0.0 && pey() == 0.0
				&& ((Dim == 3) ? (psz() == 0.0 && pez() == 0.0) : true)) {
			return true;
		} else {
			return false;
		}
	}
Exemple #6
0
void ProgramException::raise(int lineNo, 
			     const char* fileName, 
			     const char* error)
{
  ProgramException pex(lineNo, fileName, error);
  exception_action(pex, fileName, lineNo);
  throwx (pex);
}
Exemple #7
0
int		event_expulse(t_srv *srv, t_client *client)
{
  t_graphic	g;

  g.graphic = srv->views;
  g.length_graphic = -1;
  g.players = client;
  g.length_players = 1;
  return (pex(srv, &g, NULL, NULL));
}
Exemple #8
0
void		gfx_player_expulse(t_ctrl *c, t_player *p, int *ids)
{
  t_jm_list	*l;
  int		i;

  i = 0;
  l = c->l;
  while (l)
    {
      if (l->fd != -1 && l->data && ((t_handler *)l->data)->t == GFX)
	{
	  pex(l, p->id);
	  while (ids[i])
	    {
	      ppo(c, l, ids[i]);
	      i++;
	    }
	}
      l = l->next;
    }
}
Exemple #9
0
	Point pc() const {
		return Point((pex() + psx()) * 0.5, (pey() + psy()) * 0.5,
				(Dim == 3) ? ((pez() + psz()) * 0.5) : 0);
	}
Exemple #10
0
	bool is_vertical() const {
		ASSERT(!empty());
		return psx() == pex();
	}
Exemple #11
0
	vt slope() const {
		ASSERT(Dim == 2);
		return (pey() - psy()) / (pex() - psx() + SMALL);
	}
Exemple #12
0
	vt dx() const {
		return pex() - psx();
	}