void Camera::RotateLeftAroundCenter(float speed) { Vec3D d = m_up.CrossProduct(m_center - m_eye); float tam = d.Length(); d /= tam; m_eye += d * speed; }
void Camera::MoveLeft(float speed) { Vec3D d = m_up.CrossProduct(m_center - m_eye); float tam = d.Length(); d /= tam; m_center += d * speed; m_eye += d * speed; }
void Camera::MoveForward(float speed) { Vec3D d = m_center - m_eye; float tam = d.Length(); d /= tam; m_center += d * speed; m_eye += d * speed; }
vfloat CVX_Sim::GetSumForceDir(CVX_FRegion* pRegion) { //right now only fixed regions... (forced regions should be zero!) //get force only in dircetion of pull! Vec3D<> Res = GetSumForce(pRegion); Vec3D<> Dir = pRegion->Displace; if (Dir.Length2() == 0) return Res.Length(); //return magnitude of no direction... else { Dir.Normalize(); return Res.Dot(Dir); } }
void CQDM_Edit::DrawSectionPlane(bool FastMode)//draw a slice plane to reference where we're cutting { Vec3D<> WS = GetWorkSpace(); Vec3D<> v1, v2, v12, v21, ArrDir; CColor CutColor = CColor(0.3, 0.3, 0.5, 1.0); double PadOut = WS.Length()/10.0; double Plane; switch (CurSecAxis){ case ZAXIS: // DrawSecZ(CurSecLayer, LAYERMAX, CurSecFromNeg, GetCurSel()); Plane = GetXYZ(0, 0, CurSecLayer).z; v1 = Vec3D<>(-PadOut, -PadOut, Plane); v2 = Vec3D<>(WS.x+PadOut, WS.y+PadOut, Plane); v12 = Vec3D<>(v1.x, v2.y, v1.z); v21 = Vec3D<>(v2.x, v1.y, v1.z); ArrDir = Vec3D<>(0,0, CurSecFromNeg?-PadOut:PadOut); break; case YAXIS: // DrawSecY(CurSecLayer, LAYERMAX, CurSecFromNeg, GetCurSel()); Plane = GetXYZ(0, CurSecLayer, 0).y; v1 = Vec3D<>(-PadOut, Plane, -PadOut); v2 = Vec3D<>(WS.x+PadOut, Plane, WS.z+PadOut); v12 = Vec3D<>(v1.x, v1.y, v2.z); v21 = Vec3D<>(v2.x, v1.y, v1.z); ArrDir = Vec3D<>(0,CurSecFromNeg?-PadOut:PadOut, 0); break; case XAXIS: // DrawSecX(CurSecLayer, LAYERMAX, CurSecFromNeg, GetCurSel()); Plane = GetXYZ(CurSecLayer, 0, 0).x; v1 = Vec3D<>(Plane, -PadOut, -PadOut); v2 = Vec3D<>(Plane, WS.y+PadOut, WS.z+PadOut); v12 = Vec3D<>(v1.x, v1.y, v2.z); v21 = Vec3D<>(v1.x, v2.y, v1.z); ArrDir = Vec3D<>(CurSecFromNeg?-PadOut:PadOut,0,0); break; } CGL_Utils::DrawRectangle(v1, v2, !FastMode, 0, CColor(CutColor.r, CutColor.g, CutColor.b, 0.3)); CGL_Utils::DrawArrow(v1, ArrDir, CutColor); CGL_Utils::DrawArrow(v2, ArrDir, CutColor); CGL_Utils::DrawArrow(v12, ArrDir, CutColor); CGL_Utils::DrawArrow(v21, ArrDir, CutColor); }