void binBeam(Vec3f b0, Vec3f b1, Vec3f u, float radius, Intersector intersector) const { Vec3f p0 = _invT*(b0 - u*radius); Vec3f p1 = _invT*(b0 + u*radius); Vec3f p2 = _invT*(b1 + u*radius); Vec3f p3 = _invT*(b1 - u*radius); std::array<QuadSetup, 1> quads{{setupQuad(p0, p1, p2, p3)}}; iterateTiles(quads, intersector); }
void binPlane1D(Vec3f center, Vec3f a, Vec3f b, Vec3f c, Intersector intersector) const { center = _invT*center; a = _invT.transformVector(a); b = _invT.transformVector(b); c = _invT.transformVector(c); std::array<QuadSetup, 6> quads{{ setupQuad(center + c - a - b, center + c - a + b, center + c + a + b, center + c + a - b), setupQuad(center - c - a - b, center - c - a + b, center - c + a + b, center - c + a - b), setupQuad(center + b - a - c, center + b - a + c, center + b + a + c, center + b + a - c), setupQuad(center - b - a - c, center - b - a + c, center - b + a + c, center - b + a - c), setupQuad(center + a - b - c, center + a - b + c, center + a + b + c, center + a + b - c), setupQuad(center - a - b - c, center - a - b + c, center - a + b + c, center - a + b - c) }}; iterateTiles(quads, intersector); }
void binPlane(Vec3f p0, Vec3f p1, Vec3f p2, Vec3f p3, Intersector intersector) const { std::array<QuadSetup, 1> quads{{setupQuad(_invT*p0, _invT*p1, _invT*p2, _invT*p3)}}; iterateTiles(quads, intersector); }
/** Helper function to update the UI widget objects */ SystemSettings::AirframeTypeOptions ConfigMultiRotorWidget::updateConfigObjectsFromWidgets() { SystemSettings::AirframeTypeOptions airframeType = SystemSettings::AIRFRAMETYPE_FIXEDWING; QList<QString> motorList; MixerSettings *mixerSettings = MixerSettings::GetInstance(getObjectManager()); Q_ASSERT(mixerSettings); // Curve is also common to all quads: setThrottleCurve(mixerSettings, MixerSettings::MIXER1VECTOR_THROTTLECURVE1, m_aircraft->multiThrottleCurve->getCurve() ); if (m_aircraft->multirotorFrameType->itemData(m_aircraft->multirotorFrameType->currentIndex()) == SystemSettings::AIRFRAMETYPE_QUADP) { airframeType = SystemSettings::AIRFRAMETYPE_QUADP; setupQuad(true); } else if (m_aircraft->multirotorFrameType->itemData(m_aircraft->multirotorFrameType->currentIndex()) == SystemSettings::AIRFRAMETYPE_QUADX) { airframeType = SystemSettings::AIRFRAMETYPE_QUADX; setupQuad(false); } else if (m_aircraft->multirotorFrameType->itemData(m_aircraft->multirotorFrameType->currentIndex()) == SystemSettings::AIRFRAMETYPE_HEXA) { airframeType = SystemSettings::AIRFRAMETYPE_HEXA; setupHexa(true); } else if (m_aircraft->multirotorFrameType->itemData(m_aircraft->multirotorFrameType->currentIndex()) == SystemSettings::AIRFRAMETYPE_HEXAX) { airframeType = SystemSettings::AIRFRAMETYPE_HEXAX; setupHexa(false); } else if (m_aircraft->multirotorFrameType->itemData(m_aircraft->multirotorFrameType->currentIndex()) == SystemSettings::AIRFRAMETYPE_HEXACOAX) { airframeType = SystemSettings::AIRFRAMETYPE_HEXACOAX; //Show any config errors in GUI if (throwConfigError(6)) { return airframeType; } motorList << "VTOLMotorNW" << "VTOLMotorW" << "VTOLMotorNE" << "VTOLMotorE" << "VTOLMotorS" << "VTOLMotorSE"; setupMotors(motorList); // Motor 1 to 6, Y6 Layout: // pitch roll yaw double mixer [8][3] = { { 0.5, 1, -1}, { 0.5, 1, 1}, { 0.5, -1, -1}, { 0.5, -1, 1}, { -1, 0, -1}, { -1, 0, 1}, { 0, 0, 0}, { 0, 0, 0} }; setupMultiRotorMixer(mixer); m_aircraft->mrStatusLabel->setText("Configuration OK"); } else if (m_aircraft->multirotorFrameType->itemData(m_aircraft->multirotorFrameType->currentIndex()) == SystemSettings::AIRFRAMETYPE_OCTO) { airframeType = SystemSettings::AIRFRAMETYPE_OCTO; //Show any config errors in GUI if (throwConfigError(8)) { return airframeType; } motorList << "VTOLMotorN" << "VTOLMotorNE" << "VTOLMotorE" << "VTOLMotorSE" << "VTOLMotorS" << "VTOLMotorSW" << "VTOLMotorW" << "VTOLMotorNW"; setupMotors(motorList); // Motor 1 to 8: // pitch roll yaw double mixer [8][3] = { { 1, 0, -1}, { 1, -1, 1}, { 0, -1, -1}, { -1, -1, 1}, { -1, 0, -1}, { -1, 1, 1}, { 0, 1, -1}, { 1, 1, 1} }; setupMultiRotorMixer(mixer); m_aircraft->mrStatusLabel->setText("Configuration OK"); } else if (m_aircraft->multirotorFrameType->itemData(m_aircraft->multirotorFrameType->currentIndex()) == SystemSettings::AIRFRAMETYPE_OCTOV) { airframeType = SystemSettings::AIRFRAMETYPE_OCTOV; //Show any config errors in GUI if (throwConfigError(8)) { return airframeType; } motorList << "VTOLMotorN" << "VTOLMotorNE" << "VTOLMotorE" << "VTOLMotorSE" << "VTOLMotorS" << "VTOLMotorSW" << "VTOLMotorW" << "VTOLMotorNW"; setupMotors(motorList); // Motor 1 to 8: // IMPORTANT: Assumes evenly spaced engines // pitch roll yaw double mixer [8][3] = { { 0.33, -1, -1}, { 1 , -1, 1}, { -1 , -1, -1}, { -0.33, -1, 1}, { -0.33, 1, -1}, { -1 , 1, 1}, { 1 , 1, -1}, { 0.33, 1, 1} }; setupMultiRotorMixer(mixer); m_aircraft->mrStatusLabel->setText("Configuration OK"); } else if (m_aircraft->multirotorFrameType->itemData(m_aircraft->multirotorFrameType->currentIndex()) == SystemSettings::AIRFRAMETYPE_OCTOCOAXP) { airframeType = SystemSettings::AIRFRAMETYPE_OCTOCOAXP; //Show any config errors in GUI if (throwConfigError(8)) { return airframeType; } motorList << "VTOLMotorN" << "VTOLMotorNE" << "VTOLMotorE" << "VTOLMotorSE" << "VTOLMotorS" << "VTOLMotorSW" << "VTOLMotorW" << "VTOLMotorNW"; setupMotors(motorList); // Motor 1 to 8: // pitch roll yaw double mixer [8][3] = { { 1, 0, -1}, { 1, 0, 1}, { 0, -1, -1}, { 0, -1, 1}, { -1, 0, -1}, { -1, 0, 1}, { 0, 1, -1}, { 0, 1, 1} }; setupMultiRotorMixer(mixer); m_aircraft->mrStatusLabel->setText("Configuration OK"); } else if (m_aircraft->multirotorFrameType->itemData(m_aircraft->multirotorFrameType->currentIndex()) == SystemSettings::AIRFRAMETYPE_OCTOCOAXX) { airframeType = SystemSettings::AIRFRAMETYPE_OCTOCOAXX; //Show any config errors in GUI if (throwConfigError(8)) { return airframeType; } motorList << "VTOLMotorNW" << "VTOLMotorN" << "VTOLMotorNE" << "VTOLMotorE" << "VTOLMotorSE" << "VTOLMotorS" << "VTOLMotorSW" << "VTOLMotorW"; setupMotors(motorList); // Motor 1 to 8: // pitch roll yaw double mixer [8][3] = { { 1, 1, -1}, { 1, 1, 1}, { 1, -1, -1}, { 1, -1, 1}, { -1, -1, -1}, { -1, -1, 1}, { -1, 1, -1}, { -1, 1, 1} }; setupMultiRotorMixer(mixer); m_aircraft->mrStatusLabel->setText("Configuration OK"); } else if (m_aircraft->multirotorFrameType->itemData(m_aircraft->multirotorFrameType->currentIndex()) == SystemSettings::AIRFRAMETYPE_TRI) { airframeType = SystemSettings::AIRFRAMETYPE_TRI; //Show any config errors in GUI if (throwConfigError(3)) { return airframeType; } if (m_aircraft->triYawChannelBox->currentText() == "None") { m_aircraft->mrStatusLabel->setText("<font color='red'>Error: Assign a Yaw channel</font>"); return airframeType; } motorList << "VTOLMotorNW" << "VTOLMotorNE" << "VTOLMotorS"; setupMotors(motorList); GUIConfigDataUnion config = GetConfigData(); config.multi.TRIYaw = m_aircraft->triYawChannelBox->currentIndex(); SetConfigData(config); // Motor 1 to 6, Y6 Layout: // pitch roll yaw double mixer [8][3] = { { 0.5, 1, 0}, { 0.5, -1, 0}, { -1, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0}, { 0, 0, 0} }; setupMultiRotorMixer(mixer); //tell the mixer about tricopter yaw channel int channel = m_aircraft->triYawChannelBox->currentIndex()-1; if (channel > -1) { setMixerType(mixerSettings, channel, MixerSettings::MIXER1TYPE_SERVO); setMixerVectorValue(mixerSettings, channel, MixerSettings::MIXER1VECTOR_YAW, 127); } m_aircraft->mrStatusLabel->setText(tr("Configuration OK")); } return airframeType; }