Example #1
0
static ES_Event DuringFollowTape( ES_Event Event)
{
    ES_Event ReturnEvent = Event; 
    if ( (Event.EventType == ES_ENTRY) ||
         (Event.EventType == ES_ENTRY_HISTORY) )
    {
			FollowTape(true,NOMINAL_FOLLOW_TAPE_DUTY, NOMINAL_FOLLOW_TAPE_DUTY);
			setZonesForAlign(0, 0,true);
			// Guard condition for entering zone three
			//Target Complete?
			//Position of other Karts?
			//Lap Count?
			/*
			if(!TargetCompletionStatus() && lastLapCount != getLapsRemaining() && 
				getKartAZone() != 3 && getKartBZone()!=3)
			*/
			
			if((!TargetCompletionStatus() && lastLapCount != getLapsRemaining()&& 
				getKartAZone() != 3 && getKartBZone()!=3)){
				countEdges(EDGE_DISTANCE_TO_SHOOTING_ZONE_CENTER); //edges
			}
				//if(!TargetCompletionStatus()){
				//countEdges(EDGE_DISTANCE_TO_SHOOTING_ZONE_CENTER); //edges
				//}
			}
    else if ( Event.EventType == ES_EXIT )
    {

    }else
    {
    }
    return(ReturnEvent);
}
TSP_Data::TSP_Data(ListGraph &graph,NodeName &nodename,NodePos &posicaox,
		   NodePos &posicaoy,EdgeWeight &eweight):
  g(graph),
  vname(nodename),
  ename(graph),
  vcolor(graph),
  ecolor(graph),
  weight(eweight),
  posx(posicaox),
  posy(posicaoy),
  AdjMat(graph,eweight,BC_INF), //
  BestCircuit(countEdges(graph)) 
{
  NNodes=countNodes(this->g);
  NEdges=countEdges(this->g);
  BestCircuitValue = DBL_MAX;
  max_perturb2opt_it = 3000; // default value
}
Example #3
0
/***************************************************************************
 private functions
 ***************************************************************************/
static ES_Event DuringBackAwayFromObstacle( ES_Event Event){
	 ES_Event ReturnEvent = Event; 
    if ( (Event.EventType == ES_ENTRY) ||
         (Event.EventType == ES_ENTRY_HISTORY) )
    {   
			
			countEdges(BACK_UP_FROM_OBSTACLE_DISTANCE*EDGES_PER_INCH);
			//enableSpeedControl(true,BACK_UP_FROM_OBSTACLE_SPEED,true);
			enableSpeedControl(true,10,false);
    }
    else if ( Event.EventType == ES_EXIT )
    {
    }else
    {
   
    }
    return(ReturnEvent);
	
	
	
	
}
Example #4
0
void
countSubents()
{
    AcBr::ErrorStatus returnValue = AcBr::eOk;
    Acad::ErrorStatus acadReturnValue = eOk;

    // Get the subentity path for a brep
	AcDbFullSubentPath subPath(kNullSubent);
	acadReturnValue = selectEntity(AcDb::kNullSubentType, subPath);
	if (acadReturnValue != eOk) {
		acutPrintf(ACRX_T("\n Error in getPath: %d"), acadReturnValue);
		return;
	}

	// Make a brep entity to access the solid
	AcBrBrep brepEntity;
	returnValue = ((AcBrEntity*)&brepEntity)->set(subPath);
	if (returnValue != AcBr::eOk) {
		acutPrintf(ACRX_T("\n Error in AcBrBrep::set:"));
		errorReport(returnValue);
		return;
	}

	// count the unique complexes in the brep
	returnValue = countComplexes(brepEntity);
	if (returnValue != AcBr::eOk) {
		acutPrintf(ACRX_T("\n Error in countComplexes:"));
		errorReport(returnValue);
		return;
	}

	// count the unique shells in the brep
	returnValue = countShells(brepEntity);
	if (returnValue != AcBr::eOk) {
		acutPrintf(ACRX_T("\n Error in countShells:"));
		errorReport(returnValue);
		return;
	}

	// count the unique faces in the brep
	returnValue = countFaces(brepEntity);
	if (returnValue != AcBr::eOk) {
		acutPrintf(ACRX_T("\n Error in countFaces:"));
		errorReport(returnValue);
		return;
	}

	// count the unique edges in the brep
	returnValue = countEdges(brepEntity);
	if (returnValue != AcBr::eOk) {
		acutPrintf(ACRX_T("\n Error in countEdges:"));
		errorReport(returnValue);
		return;
	}

	// count the unique vertices in the brep
	returnValue = countVertices(brepEntity);
	if (returnValue != AcBr::eOk) {
		acutPrintf(ACRX_T("\n Error in countVertices:"));
		errorReport(returnValue);
		return;
	}

	return;
}
Example #5
0
void Triangulation<2>::calculateBoundary() {
    // Are there any boundary edges at all?
    long nBdry = 2 * countEdges() - 3 * simplices_.size();
    if (nBdry == 0)
        return;

    Dim2BoundaryComponent* label;
    Dim2Triangle *tri, *adjTri;
    int edgeId, adjEdgeId;
    int vertexId, adjVertexId;
    Dim2Edge *adjEdge;
    Dim2Vertex* vertex;
    Dim2VertexEmbedding vertexEmb;

    for (Dim2Edge* edge : edges()) {
        // We only care about boundary edges that we haven't yet seen..
        if (edge->degree() == 2 || edge->boundaryComponent_)
            continue;

        label = new Dim2BoundaryComponent();
        boundaryComponents_.push_back(label);
        edge->component()->boundaryComponents_.push_back(label);

        // Loop around from this boundary edge to
        // completely enumerate all edges in this boundary component.

        tri = edge->front().triangle();
        edgeId = edge->front().edge();
        vertexId = edge->front().vertices()[0];
        vertex = tri->regina::detail::SimplexFaces<2, 0>::face_[vertexId];
        while (true) {
            if (! edge->boundaryComponent_) {
                edge->boundaryComponent_ = label;
                label->edges_.push_back(edge);

                vertex->boundaryComponent_ = label;
                label->vertices_.push_back(vertex);
            } else {
                // We've looped right around.
                break;
            }

            // Find the next edge along the boundary.

            // We can be clever about this.  The current
            // boundary edge is one end of the vertex link; the
            // *adjacent* boundary edge must be at the other.
            vertexEmb = vertex->front();
            if (vertexEmb.triangle() == tri &&
                    vertexEmb.vertices()[0] == vertexId &&
                    vertexEmb.vertices()[2] == edgeId) {
                // We are currently looking at the embedding at the
                // front of the list.  Take the one at the back.
                vertexEmb = vertex->back();

                adjTri = vertexEmb.triangle();
                adjEdgeId = vertexEmb.vertices()[1];
                adjEdge = adjTri->regina::detail::SimplexFaces<2, 1>::face_[adjEdgeId];
                adjVertexId = vertexEmb.vertices()[2];
            } else {
                // We must be looking at the embedding at the back
                // of the list.  Take the one at the front (which is
                // already stored in vertexEmb).
                adjTri = vertexEmb.triangle();
                adjEdgeId = vertexEmb.vertices()[2];
                adjEdge = adjTri->regina::detail::SimplexFaces<2, 1>::face_[adjEdgeId];
                adjVertexId = vertexEmb.vertices()[1];

                // TODO: Sanity checking; remove this eventually.
                vertexEmb = vertex->back();
                if (! (vertexEmb.triangle() == tri &&
                        vertexEmb.vertices()[0] == vertexId &&
                        vertexEmb.vertices()[1] == edgeId)) {
                    std::cerr << "ERROR: Something has gone terribly "
                              "wrong in computeBoundaryComponents()."
                              << std::endl;
                    ::exit(1);
                }
            }

            edge = adjEdge;
            tri = adjTri;
            edgeId = adjEdgeId;
            vertexId = adjVertexId;
            vertex = tri->regina::detail::SimplexFaces<2, 0>::face_[vertexId];
        }
    }
}