void Triangle::setWidth(Scalar newWidth) { width=newWidth; /* Re-calculate triangle shape: */ calculateShape(); }
void Triangle::setRadius(Scalar newRadius) { /* Set radius: */ radius=newRadius; radius2=Math::sqr(radius); /* Re-calculate triangle shape: */ calculateShape(); }
void Cylinder::setRadius(Scalar newRadius) { /* Set cylinder size: */ radius=newRadius; radius2=Math::sqr(radius); /* Re-calculate cylinder shape: */ calculateShape(); }
void Octahedron::setRadius(Scalar newRadius) { /* Set octahedron size: */ radius=newRadius; radius2=Math::sqr(radius); /* Re-calculate octahedron shape: */ calculateShape(); }
void Cylinder::initClass(const Misc::ConfigurationFileSection& configFileSection) { /* Read class settings: */ radius=configFileSection.retrieveValue<Scalar>("./radius",2.0); radius2=Math::sqr(radius); mass=configFileSection.retrieveValue<Scalar>("./mass",4.0); /* Calculate cylinder shape: */ calculateShape(); /* Create cylinder renderer: */ unitRenderer=new CylinderRenderer; }
void Octahedron::initClass(const Misc::ConfigurationFileSection& configFileSection) { /* Read class settings: */ radius=configFileSection.retrieveValue<Scalar>("./radius",1.9); radius2=Math::sqr(radius); mass=configFileSection.retrieveValue<Scalar>("./mass",4.0/3.0); /* Calculate octahedron shape: */ calculateShape(); /* Create octahedron renderer: */ unitRenderer=new OctahedronRenderer; }
void Triangle::initClass(const Misc::ConfigurationFileSection& configFileSection) { /* Read class settings: */ radius=configFileSection.retrieveValue<Scalar>("./radius",1.550185); radius2=Math::sqr(radius); width=configFileSection.retrieveValue<Scalar>("./width",0.25); mass=configFileSection.retrieveValue<Scalar>("./mass",1.0); /* Calculate triangle shape: */ calculateShape(); /* Create triangle renderer: */ unitRenderer=new TriangleRenderer; }
/// \brief /// Decides what bid for the player to make depending on their hand strength and shape values. /// /// \return string - the bid that the player should make. string Hand::makeBid() { int longestNum = calculateLongestSuit(); bool handBalanced = calculateShape(); if (!handBalanced) { if (handStrength <= 12) { switch(longestNum) { case 6: // Bid highest suit if there are two suits of size 6 if (longestSuit.size() == 2) { bid = "2" + suitName(longestSuit.back()); break; } // Passes if clubs suit is of size 6 if (longestSuit.front() == 0) { bid = "PASS"; break; } bid = "2" + suitName(longestSuit.front()); break; case 7: bid = "3" + suitName(longestSuit.front()); break; case 8: bid = "4" + suitName(longestSuit.front()); break; default: bid = "PASS"; break; } } else if (handStrength <= 21) { // Bid the longest suit if (longestSuit.size() == 1) { bid = "1" + suitName(longestSuit.front()); } // Bids highest suit if two suits have a size of four or lowest // suit if two suits have a size of 5 or more. else { if (longestNum == 4) { bid = "1" + suitName(longestSuit.front()); } else { bid = "1" + suitName(longestSuit.back()); } } } else { bid = "2C"; } } else { if (handStrength <= 12) { bid = "PASS"; } else if (handStrength <= 14) { bidMinorSuit(); } else if (handStrength <= 17) { bid = "1NT"; } else if (handStrength <= 19) { bidMinorSuit(); } else if (handStrength <= 21) { bid = "2NT"; } else { bid = "2C"; } } return bid; }