Exemplo n.º 1
0
void AxisAlignedBoxTest::collisionPoint() {
    Physics::AxisAlignedBox3D box({-1.0f, -2.0f, -3.0f}, {1.0f, 2.0f, 3.0f});
    Physics::Point3D point1({-1.5f, -1.0f, 2.0f});
    Physics::Point3D point2({0.5f, 1.0f, -2.5f});

    randomTransformation(box);
    randomTransformation(point1);
    randomTransformation(point2);

    VERIFY_NOT_COLLIDES(box, point1);
    VERIFY_COLLIDES(box, point2);
}
Exemplo n.º 2
0
void SphereTest::collisionLineSegment() {
    Physics::Sphere3D sphere({1.0f, 2.0f, 3.0f}, 2.0f);
    Physics::LineSegment3D line({1.0f, 2.0f, 4.9f}, {1.0f, 2.0f, 7.0f});
    Physics::LineSegment3D line2({1.0f, 2.0f, 5.1f}, {1.0f, 2.0f, 7.0f});

    randomTransformation(sphere);
    randomTransformation(line);
    randomTransformation(line2);

    VERIFY_COLLIDES(sphere, line);
    VERIFY_NOT_COLLIDES(sphere, line2);
}
Exemplo n.º 3
0
void SphereTest::collisionPoint() {
    Physics::Sphere3D sphere({1.0f, 2.0f, 3.0f}, 2.0f);
    Physics::Point3D point({1.0f, 3.0f, 3.0f});
    Physics::Point3D point2({1.0f, 3.0f, 1.0f});

    randomTransformation(sphere);
    randomTransformation(point);
    randomTransformation(point2);

    VERIFY_COLLIDES(sphere, point);
    VERIFY_NOT_COLLIDES(sphere, point2);
}
Exemplo n.º 4
0
void SphereTest::collisionSphere() {
    Physics::Sphere3D sphere({1.0f, 2.0f, 3.0f}, 2.0f);
    Physics::Sphere3D sphere1({1.0f, 3.0f, 5.0f}, 1.0f);
    Physics::Sphere3D sphere2({1.0f, 3.0f, 0.0f}, 1.0f);

    randomTransformation(sphere);
    randomTransformation(sphere1);
    randomTransformation(sphere2);

    VERIFY_COLLIDES(sphere, sphere1);
    VERIFY_NOT_COLLIDES(sphere, sphere2);
}
Exemplo n.º 5
0
void CapsuleTest::collisionSphere() {
    Physics::Capsule3D capsule({-1.0f, -1.0f, 0.0f}, {1.0f, 1.0f, 0.0f}, 2.0f);
    Physics::Sphere3D sphere({3.0f, 0.0f, 0.0f}, 0.9f);
    Physics::Sphere3D sphere1({3.5f, 1.0f, 0.0f}, 0.6f);
    Physics::Sphere3D sphere2({1.0f, 4.1f, 0.0f}, 1.0f);

    randomTransformation(capsule);
    randomTransformation(sphere);
    randomTransformation(sphere1);
    randomTransformation(sphere2);

    VERIFY_COLLIDES(capsule, sphere);
    VERIFY_COLLIDES(capsule, sphere1);
    VERIFY_NOT_COLLIDES(capsule, sphere2);
}
Exemplo n.º 6
0
void CapsuleTest::collisionPoint() {
    Physics::Capsule3D capsule({-1.0f, -1.0f, 0.0f}, {1.0f, 1.0f, 0.0f}, 2.0f);
    Physics::Point3D point({2.0f, 0.0f, 0.0f});
    Physics::Point3D point1({2.9f, 1.0f, 0.0f});
    Physics::Point3D point2({1.0f, 3.1f, 0.0f});

    randomTransformation(capsule);
    randomTransformation(point);
    randomTransformation(point1);
    randomTransformation(point2);

    VERIFY_COLLIDES(capsule, point);
    VERIFY_COLLIDES(capsule, point1);
    VERIFY_NOT_COLLIDES(capsule, point2);
}
Exemplo n.º 7
0
void PlaneTest::collisionLineSegment() {
    Physics::Plane plane(Vector3(), Vector3::yAxis());
    Physics::LineSegment3D line({0.0f, -0.1f, 0.0f}, {0.0f, 7.0f, 0.0f});
    Physics::LineSegment3D line2({0.0f, 0.1f, 0.0f}, {0.0f, 7.0f, 0.0f});
    Physics::LineSegment3D line3({0.0f, -7.0f, 0.0f}, {0.0f, -0.1f, 0.0f});

    randomTransformation(plane);
    randomTransformation(line);
    randomTransformation(line2);
    randomTransformation(line3);

    VERIFY_COLLIDES(plane, line);
    VERIFY_NOT_COLLIDES(plane, line2);
    VERIFY_NOT_COLLIDES(plane, line3);
}
Exemplo n.º 8
0
void Docking::NachoptimierungR(Protein* p,int score,Vector3 shift_back, System s1){

	Protein copy1(*p, true);
	Protein* copy = &copy1;
	
	TranslationProcessor translation;
	Vector3 toOrigin = shift_back*(-1);
	translation.setTranslation(toOrigin);
	
	copy->apply(translation);
		
	srand(time(NULL));
	
	Matrix4x4 randomMatrix;
	
	//nachoptimierung nur minimal da score schon gut
	
	float angle = 1 + rand() %  (10 - 1 + 1);
	
	Angle randomAngle(angle, false);
	
	//Random Vektor als rotationsaxe
	int min = -3;
	int max = 3;
	
	float x = min + rand() % (max - min +1);
	float y = min + rand() % (max - min +1);
	float z = min + rand() % (max - min +1);
	
	Vector3 vec(x,y,z);
	
	randomMatrix.setRotation(randomAngle,vec);
	
	TransformationProcessor randomTransformation(randomMatrix);
	copy->apply(randomTransformation);
	
	TranslationProcessor translation2;
	translation2.setTranslation(shift_back);
	
	copy->apply(translation2);
	
	vector<Vector3> position  = data.savePositions(copy);

	float newscore = scoring(position);
	
	//nur wenn der score höher ist interessierr er uns
	if(newscore > score){

		System opt;
		opt.insert(*copy);
		data.writeFinalComplex(s1, opt, score, newscore);

	}

}