void TestSpawnTeleport() {
    std::cout << "TEST EMPTY\n";
    TBoard board(8, 8);

    TUnit::TSegments segments = {
        TSegment(Coords::TColRowPoint(0, 0)),
        TSegment(Coords::TColRowPoint(1, 0)),
        TSegment(Coords::TColRowPoint(1, 1)),
        TSegment(Coords::TColRowPoint(2, 1)),
    };

    /*  xX */
    TUnit unit(
        TSegment(Coords::TColRowPoint(1, 0)),
        std::move(segments)
    );
    auto teleported = board.TeleportUnitToSpawnPosition(unit);
    if (teleported.GetPivot().GetPosition().Column != 4) {
        throw TException("TestSpawnTeleport error")
            << __FILE__ << ":" << __LINE__
            << " :\n" << teleported.GetPivot().GetPosition().Column << "\n"
            << "expected: 4"
        ;
    }
}
void TUnit::DebugPrint() const {
    std::cerr
            << "{ " << GetPivot().GetPosition().Column
            << ", " << GetPivot().GetPosition().Row
            << " }: [";
    for (const auto& segment : GetSegments()) {
        std::cerr
                << "{ " << segment.GetPosition().Column
                << ", " << segment.GetPosition().Row
                << " },";
    }
    std::cerr << "]" << std::endl;
}
void CosineTreeBuilder::CTNodeSplit(CosineTree& root, CosineTree& left,
                                    CosineTree& right)
{
  //Extracting points from the root
  arma::mat A = root.Data();
  //Cosine Similarity Array
  std::vector<double> c;
  //Matrices holding points for the left and the right node
  arma::mat ALeft, ARight;
  //Sampling probabilities
  arma::vec prob = root.Probabilities();
  //Pivot
  size_t pivot = GetPivot(prob);
  //Creating Array
  CreateCosineSimilarityArray(c,A,pivot);
  //Splitting data points
  SplitData(c,ALeft,ARight,A);
  //Creating Nodes
  if(ALeft.n_rows > 0)
  {
    CTNode(ALeft.t(),left);
    //TODO: Traversal is not required, still fix this
    //root.Left(left);
  }
  if(ARight.n_rows > 0)
  {
    CTNode(ARight.t(),right);
    //TODO: Traversal is not required, still fix this
    //root.Right(right);
  }
}
	glm::vec2	UIElement::GetBound(Location bl_Side){

		glm::vec2 Min,Max;
		GetPivot(&Min,&Max);

		switch(bl_Side){
			case TOP_LEFT:		return ((v2Size != glm::vec2(0)) ? glm::vec2(v4Translate.x + Min.x	,v4Translate.y + Min.y) : glm::vec2(-999999.0f,-999999.0f));
			case TOP_RIGHT:		return ((v2Size != glm::vec2(0)) ? glm::vec2(v4Translate.x + Max.x	,v4Translate.y + Min.y) : glm::vec2( 999999.0f,-999999.0f));
			case BOTTOM_LEFT:	return ((v2Size != glm::vec2(0)) ? glm::vec2(v4Translate.x + Min.x	,v4Translate.y + Max.y) : glm::vec2(-999999.0f, 999999.0f));
			case BOTTOM_RIGHT:	return ((v2Size != glm::vec2(0)) ? glm::vec2(v4Translate.x + Max.x	,v4Translate.y + Max.y) : glm::vec2( 999999.0f, 999999.0f));
		}
		return glm::vec2(0);
	}
Exemple #5
0
m2::RectD Bookmark::GetViewport() const
{
  return m2::RectD(GetPivot(), GetPivot());
}