Пример #1
0
/* Test evolution from genotype frequencies */
int pop_evolve_gf() {
	int L = 4;
	int N = 10000;

	haploid_lowd pop(L);

	// Start with wildtype and a single mutant
	index_value_pair_t ivp(0, N/2);
	vector<index_value_pair_t> gts;
	gts.push_back(ivp);
	ivp.index = 1;
	gts.push_back(ivp);
	pop.set_genotypes(gts);

	double* rr = new double[L-1];
	for(int i=0; i < L-1; i++)
		rr[i] = 0.01;
	pop.set_recombination_rates(rr);	
	pop.set_mutation_rates(1e-2);
	pop.evolve(5);

	if(LOWD_VERBOSE) {
		cerr<<"Population size: "<<pop.N()<<endl;
	}
	return 0;	
}
Пример #2
0
void CPhysicsTrace::SweepIVP( const Vector &start, const Vector &end, const IVP_Compact_Surface *pSweptSurface, const QAngle &sweptAngles, const IVP_Compact_Surface *pSurface, const Vector &surfaceOrigin, const QAngle &surfaceAngles, trace_t *ptr )
{
	ClearStatDotProduct();
	CM_ClearTrace( ptr );

	CTraceIVP sweptObject( pSweptSurface, vec3_origin, sweptAngles, *this );
	CTraceIVP ivp( pSurface, surfaceOrigin, surfaceAngles, *this );
	CTraceRay ray( start, end );

	sweptObject.SetSingleConvex();

	CTraceSolverSweptObject solver( ptr, &sweptObject, &ray, &ivp, start - surfaceOrigin, MASK_ALL, NULL );
	solver.DoSweep();
	ptr->endpos = start*(1.f-ptr->fraction) + end * ptr->fraction;
}
Пример #3
0
void CPhysicsTrace::SweepBoxIVP( const Ray_t &raySrc, unsigned int contentsMask, IConvexInfo *pConvexInfo, const IVP_Compact_Surface *pSurface, const Vector &surfaceOrigin, const QAngle &surfaceAngles, trace_t *ptr )
{
	ClearStatDotProduct();
	CM_ClearTrace( ptr );

	CTraceAABB box( -raySrc.m_Extents, raySrc.m_Extents );
	CTraceIVP ivp( pSurface, surfaceOrigin, surfaceAngles, *this );
	CTraceRay ray( raySrc );

	CTraceSolverSweptObject solver( ptr, &box, &ray, &ivp, raySrc.m_Start - surfaceOrigin, contentsMask, pConvexInfo );
	solver.DoSweep();

	VectorAdd( raySrc.m_Start, raySrc.m_StartOffset, ptr->startpos );
	VectorMA( ptr->startpos, ptr->fraction, raySrc.m_Delta, ptr->endpos );
}
Пример #4
0
Vector CPhysicsTrace::GetExtent( const IVP_Compact_Surface *pCollide, const Vector &collideOrigin, const QAngle &collideAngles, const Vector &direction )
{
	int index;
	CTraceIVP ivp( pCollide, collideOrigin, collideAngles, *this );

	if ( ivp.SetSingleConvex() )
	{
		return ivp.SupportMap( direction, index );
	}
	else
	{
		const IVP_Compact_Ledgetree_Node *lt_node_root;
		lt_node_root = pCollide->get_compact_ledge_tree_root();
		Vector out = vec3_origin;
		float tmp = -1e6;
		TraceGetExtent_r( lt_node_root, ivp, direction, tmp, out );
		return out;
	}
}
Пример #5
0
void CPhysicsTrace::GetAABB( Vector &mins, Vector &maxs, const IVP_Compact_Surface *pCollide, const Vector &collideOrigin, const QAngle &collideAngles )
{
	int index;
	CTraceIVP ivp( pCollide, collideOrigin, collideAngles, *this );

	if ( ivp.SetSingleConvex() )
	{
		mins.x = ivp.SupportMap( g_xneg, index ).x;
		mins.y = ivp.SupportMap( g_yneg, index ).y;
		mins.z = ivp.SupportMap( g_zneg, index ).z;

		maxs.x = ivp.SupportMap( g_xpos, index ).x;
		maxs.y = ivp.SupportMap( g_ypos, index ).y;
		maxs.z = ivp.SupportMap( g_zpos, index ).z;
	}
	else
	{
		const IVP_Compact_Ledgetree_Node *lt_node_root;
		lt_node_root = pCollide->get_compact_ledge_tree_root();
		ClearBounds( mins, maxs );
		TraceGetAABB_r( mins, maxs, lt_node_root, ivp );
	}
}