// construct WorldParamsPrior(const std::vector<distrib::MultiGaussian>& ctrlpts_, const std::vector<Eigen::MatrixXi>& ctrlptMasks_, const std::vector<Eigen::MatrixXd>& ctrlptMins_, const std::vector<Eigen::MatrixXd>& ctrlptMaxs_, const Eigen::VectorXd& ctrlptCoupledSds_, const Eigen::VectorXd& ctrlptUncoupledSds_, const std::vector<distrib::MultiGaussian>& properties_, const std::vector<Eigen::VectorXi>& propMasks_, const std::vector<Eigen::VectorXd>& propMins_, const std::vector<Eigen::VectorXd>& propMaxs_, const std::vector<BoundaryClass>& classes_) : ctrlptMasks(ctrlptMasks_), ctrlptMins(ctrlptMins_), ctrlptMaxs(ctrlptMaxs_), ctrlptCoupledSds(ctrlptCoupledSds_), ctrlptUncoupledSds(ctrlptUncoupledSds_), ctrlptPrior(ctrlpts_), propMasks(propMasks_), propMins(propMins_), propMaxs(propMaxs_), propertyPrior(properties_), classes(classes_) { for (uint l = 0; l < propMasks.size(); l++) { for (uint p = 0; p < propMasks_[l].size(); p++) { if (!propMasks_[l](p)) { propertyPrior[l].sigma.row(p).setZero(); propertyPrior[l].sigma.col(p).setZero(); propertyPrior[l].sigma(p, p) = 1; } } } for (uint l = 0; l < ctrlptMasks_.size(); l++) { Eigen::MatrixXi masks = ctrlptMasks_[l]; masks.resize(masks.rows() * masks.cols(), 1); for (uint p = 0; p < masks.rows(); p++) { if (!masks(p)) { ctrlptPrior[l].sigma.row(p).setZero(); ctrlptPrior[l].sigma.col(p).setZero(); ctrlptPrior[l].sigma(p, p) = 1; } } } WorldParams minParams; WorldParams maxParams; minParams.rockProperties = propMins; maxParams.rockProperties = propMaxs; minParams.controlPoints = ctrlptMins; maxParams.controlPoints = ctrlptMaxs; thetaMin = deconstruct(minParams); thetaMax = deconstruct(maxParams); VLOG(1) << "Theta min:" << thetaMin.transpose(); VLOG(1) << "Theta max:" << thetaMax.transpose(); }
// Toggle the style of the landscape. void BoidsLand::toggleUnlitFlat( ) { // Deconstruct the landscape. if ( landFrame ) { deconstruct( ); } // Perform the toggle. if ( solidStyle == D3DRMRENDER_UNLITFLAT && solidOn == true ) { solidOn = false; // Update the flag. } else { solidStyle = D3DRMRENDER_UNLITFLAT; // Update the style. solidOn = true; // Update the flag. } // Re-build the landscape if required. if ( solidOn || wireframeOn ) { build( window, d3drm, scene, solidStyle ); } }
// Remove the landscape. void BoidsLand::renderNone( ) { // Deconstruct the landscape. deconstruct( ); solidOn = false; // Update the flags. wireframeOn = false; }
digit* buildbigint(unsigned int x) { if(x == 0) return 0; std::pair<unsigned int, char> x_deconstructed = deconstruct(x); digit* big = new digit; big->n = x_deconstructed.second; big->next = buildbigint(x_deconstructed.first); return big; }
int main() { Node *head; head = newNode(); construct(head); traverse(head); head = reverse(head); traverse(head); deconstruct(head); return 0; }
// Set the colour of the solid landscape. void BoidsLand::setSolidColour( SolidColourEnum colour ) { // Re-build the landscape if required. if ( !solidOn || solidColour != colour ) { // Deconstruct the landscape. deconstruct( ); solidOn = true; // Update the flag. solidColour = colour; // Set the colour. build( window, d3drm, scene, solidStyle ); } }
// Destroy, recalculate and redraw the landscape. void BoidsLand::recalculate( ) { // Deconstruct the landscape. if ( landFrame ) { deconstruct( ); } // Call the member function to produce the landscape altitudes. calcHeights( ); // If the lanscape is not present, bring it back as a wireframe - // - to show the recalculation. if ( solidOn == false && wireframeOn == false ) { wireframeOn = true; } // Re-build the landscape. build( window, d3drm, scene, solidStyle ); }
void Environment::load() { deconstruct(); auto ptr = #if defined(PRI_TARGET_UNIX) environ; #else _wenviron; #endif if (ptr == nullptr) { map.clear(); return; } string_map env; NativeString key, value, kv; for (; *ptr != nullptr; ++ptr) { kv = *ptr; str_partition_at(kv, key, value, PRI_CSTR("=", NativeCharacter)); env[key] = value; } map.swap(env); }
// Toggle the style of the landscape. void BoidsLand::toggleWireframe( ) { // Deconstruct the landscape. if ( landFrame ) { deconstruct( ); } // Perform the toggle. if ( wireframeOn ) { wireframeOn = false; // Update the flag. } else { wireframeOn = true; // Update the flag. } // Re-build the landscape if required. if ( solidOn || wireframeOn ) { build( window, d3drm, scene, solidStyle ); } }
Environment& Environment::operator=(Environment&& env) noexcept { map = std::move(env.map); deconstruct(); env.deconstruct(); return *this; }
Environment& Environment::operator=(const Environment& env) { map = env.map; deconstruct(); return *this; }
CGBBattleGrid::~CGBBattleGrid() { if (mConstructed) deconstruct(); }