Exemplo n.º 1
0
long __Call_ln( CDSR_VMEval& /*vm*/, MMD_Address& addr, UniWord *arg )
{
#if _DEBUG
	if( addr.param2 < 0 )
		throw _T("__Call_(fun) : internal error, out of range");
#endif
	if( addr.param2 == 0 )	// DSRDATA_TYPE_REAL
		*(arg - 1) = CDSRReal( ln( (arg - 1)->getReal() ) );
	else					// DSRDATA_TYPE_COMPLEX
		*(arg - 1) = CDSRComplex( ln( (arg - 1)->getComplex() ) );
	return 1 - addr.param3;
}
Exemplo n.º 2
0
interval FLevy2D::operator () (const LabBox & X) const
{
  n_interval_calls++;

  ivector Box = X.Box;
  int a = Lb (Box), z = Ub (Box);
  interval isum, jsum, hh;
  isum = 0.0;
  jsum = 0.0;
  for (int i = 1; i <= 5; i++)
  {
    isum = isum + double(i) * cos (double(i - 1) * Box[a] + double(i));
    jsum = jsum + double(i) * cos (double(i + 1) * Box[z] + double(i));
  }

                    // Avoid real con-
  hh = isum * jsum + sqr (Box[a] + Center1) +
                    // version error
    sqr (Box[z] + Center2);
    hh += GlobalMax;  
  // TEMPERATURE = 1, 4, 40, 400, 4000
  interval result = exp (-hh / Temperature);

  return (UsingLogDensity) ? ln (result) : result;
}
Exemplo n.º 3
0
void tr(n x,n y,n i)
{
        c*h,w;n*m=g(y,i); for(w=4*(x<2);++w<4&&m==g(w/2*x+y,i+w%2*x););       
        for(w=4*(w>3&&(h=x>1?ln(m):a(&y,&i))&&o("<rect style=\"fill:rgb(%d,%d,%d\
        );\" x=\"%f\" y=\"%f\" %s=\"%f\" %s=\"%f\"/>\n",*h,*(1+h),*(2+h),str(F+,
        y,i),vi(x))),x/=2;x>0&&w<4;++w)tr(x,y+w/2*x,w%2*x+i);
}
Exemplo n.º 4
0
MyPluralFormsNode*MyPluralFormsParser::logicalOrExpression()
{
    MyPluralFormsNode* p = logicalAndExpression();
    if (p == NULL)
        return NULL;
    MyPluralFormsNodePtr ln(p);
    if (token().type() == MyPluralFormsToken::T_LOGICAL_OR)
    {
        MyPluralFormsNodePtr un(new MyPluralFormsNode(token()));
        if (!nextToken())
        {
            return 0;
        }
        p = logicalOrExpression();
        if (p == 0)
        {
            return 0;
        }
        MyPluralFormsNodePtr rn(p);    // right
        if (rn->token().type() == MyPluralFormsToken::T_LOGICAL_OR)
        {
            // see logicalAndExpression comment
            un->setNode(0, ln.release());
            un->setNode(1, rn->releaseNode(0));
            rn->setNode(0, un.release());
            return rn.release();
        }


        un->setNode(0, ln.release());
        un->setNode(1, rn.release());
        return un.release();
    }
    return ln.release();
}
Exemplo n.º 5
0
real FLevy2D_Lkl_Tfrom1data::operator () (const real & X) const
{
  int a = Lb (Data), z = Ub (Data);
  // here we simply take the mid-point of the data to get thin data
  rvector realData = mid (Data);
  real isum, jsum, hh;
  isum = 0.0;
  jsum = 0.0;
  for (int i = 1; i <= 5; i++)
  {
    isum =
      isum + double (i) * cos (double (i - 1) * realData[a] +
      double (i));
    jsum =
      jsum + double (i) * cos (double (i + 1) * realData[z] +
      double (i));
  }

                    // Avoid real con-
  hh = isum * jsum + sqr (realData[a] + Center1) +
                    // version error
    sqr (realData[z] + Center2);
  hh += GlobalMax;

  // TEMPERATURE = 1, 4, 40, 400, 4000
  real result = exp (-hh / X);
  result /= sqr (X);
  return (UsingLogDensity) ? ln (result) : result;
}
static char* get_vtbl_hint(int line_num)
{
	current_line_pos = line_num;
	char tag_lines[4096];
	ZeroMemory(tag_lines, sizeof(tag_lines));

	if (isEnabled(vtbl_t_list[line_num].ea_begin))
	{
		int flags = calc_default_idaplace_flags();
		linearray_t ln(&flags);
		idaplace_t pl;
		pl.ea = vtbl_t_list[line_num].ea_begin;
		pl.lnnum = 0;
		ln.set_place(&pl);

		int used = 0;
		int n = ln.get_linecnt();
		for (int i = 0; i < n; i++)
		{
			char buf[MAXSTR];
			char *line = ln.down();
			tag_remove(line, buf, sizeof(buf));
			used += sprintf_s(tag_lines + used, sizeof(tag_lines) - used, "%s\n", buf);
		}

	}

	return qstrdup(tag_lines);
}
Exemplo n.º 7
0
real FLevy2D::operator () (const LabPnt & X) const
{
  n_real_calls++;
  rvector Pnt = X.Pnt;
  int a = Lb (Pnt), z = Ub (Pnt);
  real isum, jsum, hh;
  isum = 0.0;
  jsum = 0.0;

  for (int i = 1; i <= 5; i++)
  {
    isum = isum + double (i) * cos (double (i - 1) * Pnt[a] + double (i));
    jsum = jsum + double (i) * cos (double (i + 1) * Pnt[z] + double (i));
  }
  // Avoid real conversion error
  hh = isum * jsum + sqr (Pnt[a] + Center1) +
       sqr (Pnt[z] + Center2);
  hh += GlobalMax;

  // TEMPERATURE = 1, 4, 40, 400, 4000
  real result = exp (-hh / Temperature);
  //result /= sqrt(Temperature);
  //result /= Temperature;
  assert (result < 1.0);
  return (UsingLogDensity) ? ln (result) : result;
}
Exemplo n.º 8
0
interval FLevy2D_Lkl_Tfrom1data::operator () (const interval & X) const
{
  int a = Lb (Data), z = Ub (Data);
  interval isum, jsum, hh;
  isum = 0.0;
  jsum = 0.0;
  for (int i = 1; i <= 5; i++)
  {
    isum =
      isum + double (i) * cos (double (i - 1) * Data[a] + double (i));
    jsum =
      jsum + double (i) * cos (double (i + 1) * Data[z] + double (i));
  }
                    // Avoid real con-
  hh = isum * jsum + sqr (Data[a] + Center1) +
                    // version error
    sqr (Data[z] + Center2);
  hh += GlobalMax;

   // TEMPERATURE = 1, 4, 40, 400, 4000
  interval result = exp (-hh / X);

  result /= sqr (X);
  //result /= X;
  return (UsingLogDensity) ? ln (result) : result;
}
Exemplo n.º 9
0
void NumberDouble<T>::naturalLog(void)
{
    T realResult = ln(sqrt(realPart*realPart + imaginaryPart*imaginaryPart));
    argument();
    exchangeRealAndImaginary();
    realPart = realResult;
}
Exemplo n.º 10
0
void Line::set_hiliting(Parser* parser, IDColl* plist, int& initial_state, int pos)
{
    hl_state = initial_state;

    Line ln(this, 0, len(), 1);

    parser->reset(ln.str, hl_state);

    if(pos < 0)
        reset_type_cache();

    if(pos > 0)
        pos--;

    while(*parser->tok)
    {
        int iSz = parser->next_token();

        if(pos >= parser->offset() && pos < (parser->offset() + iSz))
        {
            token_cache_type  = parser->color;
            token_cache_start = parser->offset();
            token_cache_len   = iSz;
        }

        if(plist && pos < 0 && (iSz >= iMinComplLen) && token_is_completable(parser->color))
        {
            plist->AddID(parser->tok, iSz);
        }

        parser->tok += iSz;
    }

    initial_state = parser->state;
}
Exemplo n.º 11
0
 virtual bool read(std::ifstream& in, int n, bool binary)
 {
     resize(n);
     if (binary)
     {
         in.read((char*)data, n * sizeof(T));
         if (in.eof() || in.bad())
         {
             resize(0);
             return false;
         }
     }
     else
     {
         int i = 0;
         std::string line;
         while(i < dataSize && !in.eof() && !in.bad())
         {
             std::getline(in, line);
             std::istringstream ln(line);
             while (i < n && ln >> data[i])
                 ++i;
         }
         if (i < n)
         {
             resize(0);
             return false;
         }
     }
     return true;
 }
Exemplo n.º 12
0
int Line::find_word(int start_pos, int& from, int& to)
{
	if(start_pos >= len())
	    return 0;

	Line ln(this, 0, len(), 1);

	if(!__isic(ln.str[start_pos]))
		return 0;

	while(start_pos)
	{
	    if(__issp(ln.str[start_pos - 1]))
	        break;

	    start_pos--;
	}

	from = start_pos;

	while(start_pos < len())
	{
        if(__issp(ln.str[start_pos]))
            break;

        start_pos++;
    }
    to = start_pos;

    return 1;
}
Exemplo n.º 13
0
//! Returns a 3d ray which would go through the 2d screen coodinates.
core::line3d<f32> CSceneCollisionManager::getRayFromScreenCoordinates(
	core::position2d<s32> pos, ICameraSceneNode* camera)
{
	core::line3d<f32> ln(0,0,0,0,0,0);

	if (!SceneManager)
		return ln;

	if (!camera)
		camera = SceneManager->getActiveCamera();

	if (!camera)
		return ln;

	const scene::SViewFrustum* f = camera->getViewFrustum();

	core::vector3df farLeftUp = f->getFarLeftUp();
	core::vector3df lefttoright = f->getFarRightUp() - farLeftUp;
	core::vector3df uptodown = f->getFarLeftDown() - farLeftUp;

	const core::rect<s32>& viewPort = Driver->getViewPort();
	core::dimension2d<s32> screenSize(viewPort.getWidth(), viewPort.getHeight());

	f32 dx = pos.X / (f32)screenSize.Width;
	f32 dy = pos.Y / (f32)screenSize.Height;

	if (camera->isOrthogonal())
		ln.start = f->cameraPosition + (lefttoright * (dx-0.5f)) + (uptodown * (dy-0.5f));
	else
		ln.start = f->cameraPosition;

	ln.end = farLeftUp + (lefttoright * dx) + (uptodown * dy);

	return ln;
}
Exemplo n.º 14
0
void GreenTower::fire(){
    // create the bullets
    Bullet * bullet1 = new Bullet();
    Bullet * bullet2 = new Bullet();
    Bullet * bullet3 = new Bullet();

    // set the graphics
    bullet1->setPixmap(QPixmap(":/images/greentowerbullet.png"));
    bullet2->setPixmap(QPixmap(":/images/greentowerbullet.png"));
    bullet3->setPixmap(QPixmap(":/images/greentowerbullet.png"));

    bullet1->setPos(x()+44,y()+44);
    bullet2->setPos(x()+44,y()+44);
    bullet3->setPos(x()+44,y()+44);

    QLineF ln(QPointF(x()+44,y()+44),attack_dest);
    int angle = -1 * ln.angle();

    bullet1->setRotation(angle);
    bullet2->setRotation(angle+10);
    bullet3->setRotation(angle-10);

    game->scene->addItem(bullet1);
    game->scene->addItem(bullet2);
    game->scene->addItem(bullet3);
}
Exemplo n.º 15
0
/*************************MAIN*************************/
int main (int argc, char **argv)
{
	int nflag=0;
	int iflag=0;
	char* ivalue =NULL;
	char* nvalue =NULL;

	/******************INICIO FUNCION GETOPT******************/
	int c;
	while ((c = getopt (argc, argv, "i:n:")) != -1)
		switch (c){
			case 'i':
				iflag = 1;
				ivalue=optarg;
				break;

			case 'n':
				nflag = 1;
				nvalue=optarg;
				break;

			case '?':
				if (optopt == 'n'||optopt == 'i')
					fprintf (stderr, "La opcion -%c requiere argumento (numero).\n", optopt);
				else if (isprint (optopt))
					fprintf (stderr, "-%c es una opción desconocida.\n", optopt);
				else
					fprintf (stderr,"Caracter de opción desconocida `\\x%x'.\n",optopt);
				return 1;	

			default:
				abort ();
				
		}
	/******************FIN FUNCION GETOPT******************/
	
	/******************************************************/
	/***************VALIDACIÓN DE ARGUMENTOS***************/
	if(iflag==1&&ivalue[0]=='-'&&nflag==0)
	{
		printf("ERROR: faltan argumentos de las opciones\n");
		abort();
	}
	if(nflag==1&&nvalue[0]=='-'&&iflag==0)
	{
		printf("ERROR: faltan argumentos de las opciones\n");
		abort();
	}

	/************FIN DE VALIDACIÓN DE ARGUMENTOS***********/
	/******************************************************/

	int n,i,iteraciones;
	float final;
	n = atoi(nvalue);
	i = atoi(ivalue);
	for (iteraciones = 0;iteraciones <i;iteraciones++)
	{
		final = ln(n);
	}
Exemplo n.º 16
0
 void ln(const mpz_t n, mpz_t l) {
   mpf_t tmp, tmp2;
   mpf_inits(tmp, tmp2, NULL);
   mpf_set_z(tmp, n);
   ln(tmp, tmp2);
   mpz_set_f(l, tmp2);
   mpf_clears(tmp, tmp2, NULL);            
 }
Exemplo n.º 17
0
//-------------------------------------------------------
void coQuat_f::squadSetup(coQuat& _out0, coQuat& _out1, coQuat& _out2, const coQuat& _q0, const coQuat& _q1, const coQuat& _q2, const coQuat& _q3)
{
	coQuat q1		= _q1;
	coQuat q2		= _q2;
	coQuat q3		= _q3;

	syncQuat(_q0,	q1);
	syncQuat(q1,	q2);
	syncQuat(q2,	q3);

	const coQuat q1Conj		= conj(q1);
	const coQuat q2Conj		= conj(q2);

	_out0 = q1 * exp(-0.25f *( ln( q1Conj*q2 ) + ln( q1Conj*_q0) ) );
	_out1 = q2 * exp(-0.25f *( ln( q2Conj*q3 ) + ln( q2Conj*q1) ) );
	_out2 = q2;
}
Exemplo n.º 18
0
void sort(int * arr,int size){
	printArr(arr,size,-1,-1);	
	ln();
	
	int x=0;
	int loopCount=0;
	bool headChanged=false;
	bool tailChanged=false;
	int temp;
	do {
		headChanged=false;
		tailChanged=false;
		if(arr[x]>arr[x+1]){
			headChanged=true;
			temp=arr[x];
			arr[x]=arr[x+1];
			arr[x+1]=temp;
		}
		
		if(arr[size-x-1]>arr[size-x] and x>=1){
			tailChanged=true;
			temp=arr[size-x];
			arr[size-x]=arr[size-x-1];
			arr[size-x-1]=temp;
		}
		
		if(tailChanged or headChanged){
			ln();
			int tail=-1;
			int head=-1;
			if (tailChanged){
				tail=size-x;
			}
			if (headChanged) {
				head=x;
			}
			printArr(arr,size,tail,head);
			x=0;
		} else {
			x++;
		}
		loopCount++;
	} while((tailChanged or headChanged) or x<size-1);
	ln();
	out("Number of iterations: %i",loopCount);
}
Exemplo n.º 19
0
void Laplace2DT3::set(const Side* sd)
{
   _nb_dof = 1;
   Init(sd);
   Line2 ln(_theSide);
   _length = ln.getLength();
   sMat = 0;
   sRHS = 0;
}
Exemplo n.º 20
0
 void Tower::fire()
{
        Bullet* bullet = new Bullet();
        bullet->setPos(x()+90,y()+90);
        QLineF ln(QPointF(x()+44,y()+44), attack_dest); //to attack to mouse pos--->QCursor::pos()
        int angle = -1*ln.angle();
        bullet->setRotation(angle);
        game->scene->addItem(bullet);
 }
Exemplo n.º 21
0
double F::DISTANCE::GetLineSegmentPointDistance(const CLineSegment &_ls, const CVector &_p )
{
	CLine ln(_ls);
	double dist = GetLinePointDistance(ln,_p);

	if(F::INTERSECTION::PointProjectionOnLineSegment(_p, _ls))
		return dist;

	return F::MISC::Min(GetDistance(_ls.a,_p), GetDistance(_ls.b,_p));
}
Exemplo n.º 22
0
template<typename scalar_type> finite_hyperbox<scalar_type> finite_symmetric_bounding_box(
		const support_function_provider& s,
		const math::affine_map<scalar_type>& t) {
	scalar_type xp, xn;
	math::vdom_vector<scalar_type> v;
	bool is_empty = false;
	bool is_bounded = true;

	/* Positive and negative direction */
	positional_vdomain dom = t.domain();
	positional_vdomain codom = t.codomain();

	typename finite_hyperbox<scalar_type>::point_type c_point(codom.size(),
			scalar_type(0));
	typename finite_hyperbox<scalar_type>::point_type g_point(codom.size());

	for (unsigned int j = 0; j < codom.size(); ++j) {
		math::vdom_vector<scalar_type> lp(dom, t.get_A().vector_from_row(j));
		math::vdom_vector<scalar_type> ln(-lp);
		s.compute_support(ln, xn, v, is_empty, is_bounded);
		if (!is_bounded) {
			std::stringstream ss;
			ss << "unbounded in direction " << ln << std::endl;
			ss << "in set: " << s << std::endl;
			throw std::runtime_error(
					"finite_symmetric_bounding_box not allowed with unbounded set:\n"
							+ ss.str());
		};
		s.compute_support(lp, xp, v, is_empty, is_bounded);
		if (!is_bounded) {
			std::stringstream ss;
			ss << "unbounded in direction " << lp;
			ss << "in set: " << s << std::endl;
			throw std::runtime_error(
					"finite_symmetric_bounding_box not allowed with unbounded set:\n"
							+ ss.str());
		};
		xp += t.get_b()[j];
		xn -= t.get_b()[j];
		//std::cout << ln << ":" << xn << "..." << lp << ":" << xp << " at " << v << ", empty:" << is_empty << ", bounded:" << is_bounded << std::endl;
		if (is_empty) {
			// return an empty box
			return finite_hyperbox<scalar_type>::empty_box(codom);
		} else {
			// Use absolute value so that the generator is not negative
			// (which bef def it shouldn't be)
			if (xn > xp)
				g_point[j] = abs(xn);
			else
				g_point[j] = abs(xp);
		}
	}
	return finite_hyperbox<scalar_type> (c_point, g_point, codom);
}
Exemplo n.º 23
0
bool Node::addSuc(Node* node, float weight, bool _virtual)
{
    __CHECK_NULLPTR(node);

    if(!hasSuc(node))
    {
        Link ln(node, weight, _virtual);
        sucessors.push_back(ln);
    }
    return true;
}
Exemplo n.º 24
0
void MetalEngSenior::Attack()
{
    IronBullet *bullet = new IronBullet(AttackPower, GoldPower);
    bullet->Activated(true);
    bullet->setPos(x()+32,y()+32);                  //same position with object_center(in constructor)
    QLineF ln(QPointF(x()+32,y()+32),QPointF(Target->x()+32,Target->y()+32));      //line to target
    int angle = -1 * ln.angle();                    //angle between object and target
    bullet->setRotation(angle);                     //set rotation
    game->scene->addItem(bullet);                   //add it in game scene
    set_state(ATTACK);
}
Exemplo n.º 25
0
void DoomMap::initClassic(QIODevice* things, QIODevice* linedefs, QIODevice* sidedefs, QIODevice* vertexes, QIODevice* sectors)
{
    // linedefs, sidedefs, sectors
    // one vertex = 4 bytes
    int numvertexes = vertexes->size() / 4;
    QDataStream vertexes_stream(vertexes);
    vertexes_stream.setByteOrder(QDataStream::LittleEndian);
    for (int i = 0; i < numvertexes; i++)
    {
        qint16 x;
        qint16 y;
        vertexes_stream >> x >> y;
        DoomMapVertex vx(this);
        vx.x = (float)x;
        vx.y = (float)y;
        vertices.append(vx);
    }

    // one linedef = 14 bytes for Doom, and 16 bytes for Hexen
    int numlinedefs = (type == Hexen) ? linedefs->size() / 16 : linedefs->size() / 14;
    QDataStream linedefs_stream(linedefs);
    linedefs_stream.setByteOrder(QDataStream::LittleEndian);
    for (int i = 0; i < numlinedefs; i++)
    {
        if (type == Hexen)
        {
            quint16 v1;
            quint16 v2;
            quint16 flags;
            quint8 special;
            quint8 arg0;
            quint8 arg1;
            quint8 arg2;
            quint8 arg3;
            quint8 arg4;
            quint16 sidefront;
            quint16 sideback;
            linedefs_stream >> v1 >> v2 >> flags >> special >> arg0 >> arg1 >> arg2 >> arg3 >> arg4 >> sidefront >> sideback;
            DoomMapLinedef ln(this);
            ln.v1 = (int)v1;
            ln.v2 = (int)v2;
            ln.special = (int)special;
            ln.arg0 = (int)arg0;
            ln.arg1 = (int)arg1;
            ln.arg2 = (int)arg2;
            ln.arg3 = (int)arg3;
            ln.arg4 = (int)arg4;
            ln.sidefront = (sidefront < 0xFFFF) ? (int)sidefront : -1;
            ln.sideback = (sideback < 0xFFFF) ? (int)sideback : -1;
            // todo parse flags
            this->linedefs.append(ln);
        }
        else
        {
Exemplo n.º 26
0
template<typename scalar_type> finite_hyperbox<scalar_type> finite_bounding_box(
		const support_function_provider& s,
		const math::affine_map<scalar_type>& t) {
	scalar_type xp, xn;
	math::vdom_vector<scalar_type> v;
	bool is_empty = false;
	bool is_bounded = true;

	positional_vdomain dom = t.domain();
	positional_vdomain codom = t.codomain();

	typename finite_hyperbox<scalar_type>::point_type c_point(codom.size());
	typename finite_hyperbox<scalar_type>::point_type g_point(codom.size());

	/* Positive and negative direction */
	for (unsigned int j = 0; j < codom.size(); ++j) {
		math::vdom_vector<scalar_type> lp(dom, t.get_A().vector_from_row(j));
		math::vdom_vector<scalar_type> ln(-lp);
		s.compute_support(ln, xn, v, is_empty, is_bounded);
		if (!is_bounded) {
			std::stringstream ss;
			ss << "unbounded in direction " << ln << std::endl;
			ss << "in set: " << s << std::endl;
			throw std::runtime_error(
					"finite_bounding_box not allowed with unbounded set:\n"
							+ ss.str());
		};
		s.compute_support(lp, xp, v, is_empty, is_bounded);
		if (!is_bounded) {
			std::stringstream ss;
			ss << "unbounded in direction " << lp;
			ss << "in set: " << s << std::endl;
			throw std::runtime_error(
					"finite_bounding_box not allowed with unbounded set:\n"
							+ ss.str());
		};
		xp += t.get_b()[j];
		xn -= t.get_b()[j];
		//std::cout << l << ":" << x << " at " << v << ", empty:" << is_empty << ", bounded:" << is_bounded << std::endl;
		if (is_empty) {
			// return an empty box
			return finite_hyperbox<scalar_type>::empty_box(codom);
		} else {
			if (is_bounded) {
				c_point[j] = (xp - xn) / scalar_type(2);
				g_point[j] = xp - c_point[j];
			} else {
				throw std::runtime_error(
						"finite_bounding_box not allowed with unbounded set");
			};
		}
	}
	return finite_hyperbox<scalar_type> (c_point, g_point, codom);
}
Exemplo n.º 27
0
real acoshp1(const real& x) throw()
// acoshp1(x) = acosh(1+x);  rel. error: eps = 7.792706E-16 = e(f)
// Ausfuehrlich getestet;  Blomquist, 27.03.05;
{ 
    real res;
    int ex(expo(x));
    if (x<0) 
	cxscthrow(STD_FKT_OUT_OF_DEF("real acoshp1(const real&)"));
    // For argument x now it holds: 0 <= x <= MaxReal;
    if (ex<=-50) res = sqrt(2*x); // 0<=x<2^(-50): acoshp1(x)=sqrt(2x)
    else if (ex<=-9) // 2^(-50)<=x<2^{-9}: acoshp1(x)=sqrt(2x)*Q_4(x)
      res = sqrt(2*x)*((((q_acoshp1[4]*x+q_acoshp1[3])*x+q_acoshp1[2])
			    *x+q_acoshp1[1])*x + q_acoshp1[0]);
    else if (ex<=0) res = lnp1(x+sqrt(2*x+x*x));     // range A_3
    else if (ex<=50) res = lnp1(x*(1+sqrt(1+2/x)));  // range A_4
    else if (ex<=1022) res = ln(2*x);                // range A_5
    else res = ln(x) + c_ln2_B;                      // range A_6

    return res;
} // acoshp1
Exemplo n.º 28
0
void YellowTower::fire(){
    Bullet *bullet = new Bullet();
    bullet->setPixmap(QPixmap(":/images/arrow_yellow.png"));
    bullet->setPos(x()+18, y()+18);

    QLineF ln(QPointF(x()+18,y()+18),attack_dest);
    int angle = -1 * ln.angle(); //*(-1) for clockwise rotation

    bullet->setRotation(angle);
    game->scene->addItem(bullet);
}
Exemplo n.º 29
0
void TestRtfLevelNumbers::TestGetLevelNumber()
{
    ComparisonContext cContext;
    RTFFileContext context;
    RTFlevelnumbers ln(&context);

    assertTest(ln.m_vLevelNumbers.empty());

    assertTest(ln.GetLevelNumber(0)==-1); // mustn't blow, even on empty
    assertTest(ln.GetLevelNumber(3)==-1);
}
Exemplo n.º 30
0
void NS2DT3BT3::set(const Side* sd)
{
   _nb_dof = 3;
   Init(sd);
   Line2 ln(_theSide);
   _length = ln.getLength();
   SideNodeCoordinates();
   _dSh(1) = ln.DSh(1);
   _dSh(2) = ln.DSh(2);
   sMat = 0;
   sRHS = 0;
}