本文整理汇总了C++中Vect类的典型用法代码示例。如果您正苦于以下问题:C++ Vect类的具体用法?C++ Vect怎么用?C++ Vect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Vect类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: z
// Mnozenie wektora przez skalar
Vect operator*(const Vect &p, double d)
{
Vect z(p.getDimension());
for(int i=0; i<p.getDimension(); i++)
z.setCoordinate(i,d*p.getCoordinate(i));
return z;
};
开发者ID:awilanowska,项目名称:zpk2014,代码行数:8,代码来源:vect.cpp
示例2: logMsg
bool Env::sendMsg(long idSrc, long idDest, char *msg) {
logMsg("SEND MSG : " + std::to_string(idSrc) + " -> " + std::to_string(idDest));
// if (this->phy->getNeighbours(idSrc).count(idDest)) {
this->agents.at(idDest)->addMsg(msg);
// Display the sending message with dataAgents
Agent * agentSrc = this->agents.at(idSrc);
Agent * agentDest = this->agents.at(idDest);
Vect posSrc = PosToCell(agentSrc->getPos().x, agentSrc->getPos().y);
Vect posDest = PosToCell(agentDest->getPos().x, agentDest->getPos().y);
if (posSrc != posDest) {
float dist = ((724-Vect(posSrc - posDest).Length()) / 724.0) / 6.0;
for (float n = 0; n < 1; n += dist) {
Vect base = posDest + n * (posSrc - posDest);
Vect dirSommet = Vect(posSrc - posDest);
dirSommet.Normalize();
Vect vectBase = Vect(dirSommet.y, -dirSommet.x);
for (int j = 0; j < 20; j++) {
for (int i = -j*0.5; i <= j*0.5; i++) {
Vect point = base + j / 2.0 * dirSommet + i / 2.0 * vectBase;
if (point.x >= 0 && point.x < 512 && point.y >= 0 && point.y < 512) {
agentSrc->getVision(point.x, point.y)->dataAgent = 10 * (1 - n);
}
}
}
}
}
return true;
//}
//return false;
}
开发者ID:schlog,项目名称:camass_v2,代码行数:31,代码来源:Env.cpp
示例3: GetPoint
Bounds Bounds::GetTransformedBounds(const Matrix &m) const
{
Bounds newBounds;
BOOL bInitialized=0;
for(int i=0; i<8; i++)
{
Vect p = GetPoint(i);
p.TransformPoint(m);
if(!bInitialized)
{
newBounds.Max = newBounds.Min = p;
bInitialized = 1;
}
else
{
if(p.x < newBounds.Min.x)
newBounds.Min.x = p.x;
else if(p.x > newBounds.Max.x)
newBounds.Max.x = p.x;
if(p.y < newBounds.Min.y)
newBounds.Min.y = p.y;
else if(p.y > newBounds.Max.y)
newBounds.Max.y = p.y;
if(p.z < newBounds.Min.z)
newBounds.Min.z = p.z;
else if(p.z > newBounds.Max.z)
newBounds.Max.z = p.z;
}
}
return newBounds;
}
开发者ID:373137461,项目名称:OBS,代码行数:35,代码来源:XMath.cpp
示例4:
JNIEXPORT void JNICALL Java_neuron_Neuron_vectorToHoc
(JNIEnv *env, jclass, jlong jc, jdoubleArray ja, jint size) {
Object* ho = (Object*)jc;
Vect* vec = (Vect*)ho->u.this_pointer;
vector_resize(vec, size);
env->GetDoubleArrayRegion(ja, 0, size, &vec->elem(0));
}
开发者ID:stephanmg,项目名称:neuron,代码行数:7,代码来源:nrnjni.cpp
示例5: growVector
void
growVector()
{
CHECK (0 == Dummy::checksum());
{
typedef typename Table<HO>::Type Vect;
Vect table;
table.reserve(2);
CHECK (0 == Dummy::checksum());
cout << ".\n..install one element at index[0]\n";
table.push_back(HO());
CHECK (0 == Dummy::checksum());
create_contained_object (table[0]); // switches into "managed" state
CHECK (0 < Dummy::checksum());
int theSum = Dummy::checksum();
cout << ".\n..*** resize table to 16 elements\n";
for (uint i=0; i<15; ++i)
table.push_back(HO());
CHECK (theSum == Dummy::checksum());
}
CHECK (0 == Dummy::checksum());
}
开发者ID:,项目名称:,代码行数:27,代码来源:
示例6: SegTriInt
char AdapterComputationalGeometry::SegTriInt(Vect* T,Vect q,Vect r){
SegmentTriangleIntersection segmenttriangleintersection;
tPointi Tpoints;
tPointd qpoints;
tPointd rpoints;
tPointd ppoints;
segmenttriangleintersection.Vertices[0][0]=T[0].getPunto().getX();
segmenttriangleintersection.Vertices[0][1]=T[0].getPunto().getY();
segmenttriangleintersection.Vertices[0][2]=T[0].getPunto().getZ();
segmenttriangleintersection.Vertices[1][0]=T[1].getPunto().getX();
segmenttriangleintersection.Vertices[1][1]=T[1].getPunto().getY();
segmenttriangleintersection.Vertices[1][2]=T[1].getPunto().getZ();
segmenttriangleintersection.Vertices[2][0]=T[2].getPunto().getX();
segmenttriangleintersection.Vertices[2][1]=T[2].getPunto().getY();
segmenttriangleintersection.Vertices[2][2]=T[2].getPunto().getZ();
Tpoints[0]=0;
Tpoints[1]=1;
Tpoints[2]=2;
qpoints[0]=q.getPunto().getX();
qpoints[1]=q.getPunto().getY();
qpoints[2]=q.getPunto().getZ();
rpoints[0]=r.getPunto().getX();
rpoints[1]=r.getPunto().getY();
rpoints[2]=r.getPunto().getZ();
return segmenttriangleintersection.SegTriInt(Tpoints,qpoints,rpoints,ppoints);
}
开发者ID:gurroz,项目名称:Memori,代码行数:31,代码来源:adaptercomputationalgeometry.cpp
示例7: assert
bool VerificacionNodosVecinosColapsoRegion::corrigeInconsistencia (Malla *malla, int indNodo){
assert(malla->getNodo(indNodo)!=NULL);
Nodo* nodo=malla->getNodo(indNodo);
Vect viejaNormal=nodo->getNormal();
Vect nuevaNormal;
vector<int> indArcosVecinos=nodo->getArcos();
for (int indArco=0; indArco< (int)indArcosVecinos.size(); indArco++){
Arco* arcoVecino=malla->getArco(indArcosVecinos[indArco]);
int indPuntoA=arcoVecino->getNodoDistinto(indNodo);
Nodo* NodoA=malla->getNodo(indPuntoA);
Vect vectorVecino=NodoA->getNormal()*(val*NodoA->getConcentracion());
nuevaNormal=nuevaNormal+vectorVecino;
}
//Normalizamos.
nuevaNormal = nuevaNormal*(1/nuevaNormal.largo());
nodo->setNormal(nuevaNormal);
//Si la inconsistencia no se corrige, borramos el nodo central.
if (checkInterseccionNodo(malla,indNodo)==true){
nodo->setNormal(viejaNormal);
colapsarRegion(malla,indNodo);
return false;
}
else
ntrayectoriasreparadas++;
return true;
}
开发者ID:gurroz,项目名称:Memori,代码行数:27,代码来源:verificacionnodosvecinoscolapsoregion.cpp
示例8: GetIntersection
BOOL Plane::GetIntersection(const Vect &p1, const Vect &p2, float &fT) const
{
float P1Dist = p1.DistFromPlane(*this);
float P2Dist = p2.DistFromPlane(*this);
if(CloseFloat(P1Dist, 0.0f, EPSILON))
{
if(P2Dist == 0.0f)
return 0;
fT = 0.0f;
return 1;
}
else if(CloseFloat(P2Dist, 0.0f, EPSILON))
{
fT = 1.0f;
return 1;
}
BOOL bP1Over = (P1Dist > 0.0f);
BOOL bP2Over = (P2Dist > 0.0f);
if(bP1Over == bP2Over)
return FALSE;
float P1AbsDist = fabs(P1Dist);
float dist2 = (P1AbsDist+fabs(P2Dist));
if(dist2 < EPSILON)
return FALSE;
fT = P1AbsDist/dist2;
return TRUE;
}
开发者ID:373137461,项目名称:OBS,代码行数:33,代码来源:XMath.cpp
示例9: can_project_and_scale_points
void can_project_and_scale_points() {
FrameBuffer fb(500, 500);
Vect v = Vect(0, 0, 100);
fb.projectAndScalePoint(v);
ASSERT_EQUAL_FLOAT(v.getX(), 250, 0.1);
ASSERT_EQUAL_FLOAT(v.getY(), 250, 0.1);
}
开发者ID:sondrele,项目名称:NTNU,代码行数:7,代码来源:test_framebuffer.cpp
示例10: Vect
const Vect Vect::getNorm()const
{
Vect norming = Vect(this->m);
norming.norm();
return norming;
};
开发者ID:Norseman055,项目名称:immaterial-engine,代码行数:7,代码来源:Vect.cpp
示例11: start
void AnimController::setBonePose( PyramidObject *node )
{
PyramidObject *childNode = (PyramidObject *)node;
PyramidObject *parentNode = (PyramidObject *)node->getParent();
if( parentNode == GraphicsObjMan::getMainTree()->getRoot() )
return;
if (parentNode != 0 && childNode != 0) {
// Now get the world matrices
Vect start(0.0f,0.0f,0.0f);
parentNode->transform();
Vect ptA = start * parentNode->getWorld();
childNode->transform();
Vect ptB = start * childNode->getWorld();
// direction between the anchor points of the respective bones
Vect dir = -(ptB - ptA);
// length of the bone 0
float mag = dir.mag();
// Set the orientation and length for bone 0
Matrix S( SCALE, BONE_WIDTH, BONE_WIDTH, mag);
Quat Q( ROT_ORIENT, dir.getNorm(), Vect( 0.0f, 1.0f, 0.0f) );
Matrix T( TRANS, ptB );
Matrix BoneOrient = S * Q * T;
childNode->setBoneOrientation( BoneOrient );
}
}
开发者ID:Norseman055,项目名称:immaterial-engine,代码行数:34,代码来源:AnimController.cpp
示例12: setCoordinate
// Konstruktor kopiujacy
Vect::Vect(const Vect &w)
{
dim = w.getDimension();
v = new double[w.getDimension()];
for (int i = 0; i < w.getDimension(); i++)
setCoordinate(i, w.getCoordinate(i));
}
开发者ID:awilanowska,项目名称:zpk2014,代码行数:8,代码来源:vect.cpp
示例13: TEST
TEST(RayTracer, ray_inits) {
Ray r(Vect(0, 0, -1), Vect(-1, 0, 0));
Vect o = r.getOrigin();
Vect d = r.getDirection();
CHECK_EQUAL(-1, o.getZ());
CHECK_EQUAL(-1, d.getX());
}
开发者ID:sondrele,项目名称:NTNU,代码行数:7,代码来源:raytracer_test.cpp
示例14: r
Vect operator*(const Vect &w, double d)
{
Vect r(w.getDimension());
r = w;
for (int i = 0; i < w.getDimension(); i++)
r.setCoordinate(i, d * w.getCoordinate(i));
return r;
}
开发者ID:awilanowska,项目名称:zpk2014,代码行数:8,代码来源:vect.cpp
示例15: assert
double operator*(const Vect &w1, const Vect &w2)
{
assert (w1.getDimension() == w2.getDimension());
double d = 0;
for (int i = 0; i < w1.getDimension(); i++)
d = d + w1.getCoordinate(i) * w2.getCoordinate(i);
return d;
}
开发者ID:awilanowska,项目名称:zpk2014,代码行数:8,代码来源:vect.cpp
示例16: k
Vect operator*(const Vect &p, double d){
Vect k(p.getDimension());
for(int i = 1; i <= k.getDimension(); i++){
k.setCoordinate(i,p.getCoordinate(i)*d);
}
return k;
}
开发者ID:awilanowska,项目名称:zpk2014,代码行数:9,代码来源:vect.cpp
示例17: Vect
void Rand::behaviour(AgentControl *agent) {
if (t>10) {
Vect force = Vect((rand() % 100) - 50, (rand() % 100) - 50);
force.Normalize();
agent->getPhy()->applyForce(100*force);
t = 0;
}
t++;
}
开发者ID:schlog,项目名称:camass_v2,代码行数:9,代码来源:Rand.cpp
示例18: lmfree
void LinearMechanism::create()
{
int i;
lmfree();
i = 0;
Object* o = *hoc_objgetarg(++i);
if (strcmp(o->ctemplate->sym->name, "PythonObject") == 0) {
f_callable_ = o;
hoc_obj_ref(o);
c_ = matrix_arg(++i);
} else {
f_callable_ = NULL;
c_ = matrix_arg(1);
}
g_ = matrix_arg(++i);
y_ = vector_arg(++i);
if (ifarg(i + 2) && hoc_is_object_arg(i + 2) && is_vector_arg(i + 2)) {
y0_ = vector_arg(++i);
}
b_ = vector_arg(++i);
if (ifarg(++i)) {
#if HAVE_IV
Oc oc;
#endif
if (hoc_is_double_arg(i)) {
nnode_ = 1;
nodes_ = new Node*[1];
double x = chkarg(i, 0., 1.);
Section* sec = chk_access();
nodes_[0] = node_exact(sec, x);
nrn_notify_when_double_freed(&NODEV(nodes_[0]), this);
}else{
Object* o = *hoc_objgetarg(i);
check_obj_type(o, "SectionList");
SectionList* sl = new SectionList(o);
sl->ref();
Vect* x = vector_arg(i+1);
Section* sec;
nnode_ = 0;
nodes_ = new Node*[x->capacity()];
for (sec = sl->begin(); sec; sec = sl->next()) {
nodes_[nnode_] = node_exact(sec, x->elem(nnode_));
nrn_notify_when_double_freed(&NODEV(nodes_[nnode_]), this);
++nnode_;
}
if (ifarg(i+2)) {
elayer_ = vector_arg(i+2);
}
sl->unref();
}
}
model_ = new LinearModelAddition(c_, g_, y_, y0_, b_,
nnode_, nodes_, elayer_, f_callable_);
}
开发者ID:vortexlaboratory,项目名称:neuron,代码行数:57,代码来源:linmod1.cpp
示例19: assert
// Iloczyn skalarny
double operator*(const Vect &p1, const Vect &p2)
{
assert (p1.getDimension() == p2.getDimension());
double wynik = 0;
for(int i=0; i<p1.getDimension(); i++)
wynik += (p1.getCoordinate(i) * p2.getCoordinate(i));
return wynik;
};
开发者ID:awilanowska,项目名称:zpk2014,代码行数:10,代码来源:vect.cpp
示例20: assert
Vect operator-(const Vect &p1, const Vect &p2)
{
assert(p1.getDimension() == p2.getDimension());
Vect p4(p1.getDimension());
p4 = p1;
p4 -= p2;
return p4;
}
开发者ID:awilanowska,项目名称:zpk2014,代码行数:9,代码来源:Vect.cpp
注:本文中的Vect类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论