コード例 #1
0
ファイル: Trajectory.cpp プロジェクト: LiMuBei/ovise
void CTrajectory::BuildLine( const Ogre::Vector3& Start, const Ogre::Vector3& End,
	const Ogre::ColourValue& Colour, float Alpha )
{
	mLineVertices.push_back( VertexPair( Start, 
		Ogre::ColourValue( Colour.r, Colour.g, Colour.b, Alpha ) ) );
	mLineVertices.push_back( VertexPair( End, 
		Ogre::ColourValue( Colour.r, Colour.g, Colour.b, Alpha ) ) );
}
コード例 #2
0
ファイル: Trajectory.cpp プロジェクト: LiMuBei/ovise
void CTrajectory::BuildQuad( const Ogre::Vector3* Vertices, const Ogre::ColourValue& Colour,
	float Alpha )
{
	for (int i = 0; i < 4; ++i)
    {
		mLineVertices.push_back(
			VertexPair( Vertices[i], Ogre::ColourValue( Colour.r, Colour.g, Colour.b, Alpha ) ) );
		mLineVertices.push_back(
			VertexPair( Vertices[(i + 1) % 4], Ogre::ColourValue( Colour.r, Colour.g, Colour.b, Alpha ) ) );
	}
}
コード例 #3
0
ファイル: GraphIF.cpp プロジェクト: PWrGitHub194238/RIT
GraphIF::GraphIF(GraphIF * graph) {
	EdgeIF* edge { };
	EdgeCount edgeIdx { 0 };
	IteratorId vertexIterator = graph->getVertexIteratorId();
	IteratorId edgeIterator = graph->getEdgeIteratorId();

	this->vertexSet = new VertexSetImpl { graph->getNumberOfVertices() };
	graph->beginVertex(vertexIterator);
	while (graph->hasNextVertex(vertexIterator)) {
		this->vertexSet->push_back(
				new VertexImpl { graph->nextVertex(vertexIterator) });
	}

	this->edgeSet = new EdgeSetImpl { graph->getNumberOfEdges() };

	graph->beginEdge(edgeIterator);
	while (graph->hasNextEdge(edgeIterator)) {
		edge = graph->nextEdge(edgeIterator);
		this->edgeSet->push_back(
				new EdgeImpl { edgeIdx, VertexPair(
						vertexSet->getElementAt(
								edge->getSourceVertex()->getVertexIdx()),
						vertexSet->getElementAt(
								edge->getTargetVertex()->getVertexIdx())),
						edge->getEdgeCost(), edge->getConnectionType(),
						edge->getVisibility() });
		edgeIdx += 1;
	}
	graph->removeVertexIterator(vertexIterator);
	graph->removeEdgeIterator(edgeIterator);
}
コード例 #4
0
EdgeIF::EdgeIF(EdgeIF * edge) :
		EdgeIF(edge->getEdgeIdx(),
				VertexPair(edge->getSourceVertex(), edge->getTargetVertex()),
				edge->getEdgeCost(), edge->getConnectionType(),
				edge->getVisibility()) {

}
コード例 #5
0
int IcoSphere::addToVertices(std::list<VertexPair> *target, const Ogre::Vector3 &position, const Ogre::ColourValue &colour, float scale)
{
	Ogre::Matrix4 transform = Ogre::Matrix4::IDENTITY;
	transform.setTrans(position);
	transform.setScale(Ogre::Vector3(scale, scale, scale));
 
	for (int i = 0; i < (int)vertices.size(); i++)
		target->push_back(VertexPair(transform * vertices[i], colour));

	return vertices.size();
}
コード例 #6
0
ファイル: Trajectory.cpp プロジェクト: LiMuBei/ovise
void CTrajectory::BuildFilledQuad( const Ogre::Vector3* Vertices, const Ogre::ColourValue& Colour,
	float Alpha )
{
	mQuadVertices.push_back(
		VertexPair( Vertices[0], Ogre::ColourValue( Colour.r, Colour.g, Colour.b, Alpha ) ) );
	mQuadVertices.push_back(
		VertexPair( Vertices[1], Ogre::ColourValue( Colour.r, Colour.g, Colour.b, Alpha ) ) );
	mQuadVertices.push_back(
		VertexPair( Vertices[2], Ogre::ColourValue( Colour.r, Colour.g, Colour.b, Alpha ) ) );
 
	mQuadVertices.push_back(
		VertexPair( Vertices[0], Ogre::ColourValue( Colour.r, Colour.g, Colour.b, Alpha ) ) );
	mQuadVertices.push_back(
		VertexPair( Vertices[2], Ogre::ColourValue( Colour.r, Colour.g, Colour.b, Alpha ) ) );
	mQuadVertices.push_back(
		VertexPair( Vertices[3], Ogre::ColourValue( Colour.r, Colour.g, Colour.b, Alpha ) ) );
}
コード例 #7
0
int DebugDrawer::addTriangleVertex(const Ogre::Vector3 &vertex, const Ogre::ColourValue &colour)
{
	triangleVertices.push_back(VertexPair(vertex, colour));
	return trianglesIndex++;
}
コード例 #8
0
TEST ( MST_2_TEST, SMALL ) {

	VertexIF* v1 = new VertexImpl { 0 };
	VertexIF* v2 = new VertexImpl { 1 };
	VertexIF* v3 = new VertexImpl { 2 };
	VertexSetIF* vSet = new VertexSetImpl { 3 };

	std::cout << v1->toString() << std::endl;
	std::cout << v2->toString() << std::endl;
	std::cout << v3->toString() << std::endl;

	EdgeIF* e1 = new EdgeImpl { 0, VertexPair(v1, v2), 3 };
	EdgeIF* e2 = new EdgeImpl { 1,  VertexPair(v2, v3), 4 };
	EdgeIF* e3 = new EdgeImpl { 2, VertexPair(v3, v1), 5 };
	EdgeSetIF* eSet = new EdgeSetImpl { 3 };

//	std::cout << e1->toString() << std::endl;
//	std::cout << e2->toString() << std::endl;
//	std::cout << e3->toString() << std::endl;
//
//	std::cout << v1->inputEdgesToString() << std::endl;
//	std::cout << v1->outputEdgesToString() << std::endl;
//
//	std::cout << v2->inputEdgesToString() << std::endl;
//	std::cout << v2->outputEdgesToString() << std::endl;
//
//	std::cout << v3->inputEdgesToString() << std::endl;
//	std::cout << v3->outputEdgesToString() << std::endl;

	GraphIF* g = new GraphImpl(vSet, eSet);

	MSTSolverIF* p = new PrimeHeap(g);

	vSet->push_back(v1);
	vSet->push_back(v2);
	vSet->push_back(v3);

	eSet->push_back(e1);
	eSet->push_back(e2);
	eSet->push_back(e3);

//	std::cout << v1->toJSONString(JSONFormat::NONE, 9) << std::endl;
//	std::cout << v2->toJSONString(JSONFormat::NONE, 9) << std::endl;
//	std::cout << v3->toJSONString(JSONFormat::NONE, 9) << std::endl;
//
//	std::cout << e1->toJSONString(JSONFormat::NONE, 9) << std::endl;
//	std::cout << e2->toJSONString(JSONFormat::NONE, 9) << std::endl;
//	std::cout << e3->toJSONString(JSONFormat::NONE, 9) << std::endl;
//
//	std::cout << vSet->toJSONString(JSONFormat::NONE, 9) << std::endl;
//
//	std::cout << eSet->toJSONString(JSONFormat::NONE, 9) << std::endl;
//
//	std::cout << g->toJSONString(JSONFormat::PRETTY, 3) << std::endl;

	EdgeSetIF* mst = p->getMST();

//	std::cout << mst->toString() << std::endl;
//
//	std::cout << eSet->toString() << std::endl;
//
//	std::cout << vSet->toString() << std::endl;

	MemoryUtils::removeCollection(mst, false);

	MemoryUtils::removeGraph(g);
	delete p;

}