根据一边动态变化画圆
两边固定,另一边随机变化画圆 CString strText; CStatic* pAngleStatic = (CStatic*)GetDlgItem(IDC_CUR_ANGLE); float abc = std::pow((float)A_LENGTH,2) + std::pow((float)B_LENGTH,2) - std::pow((float)m_CLength,2); float twoAB = 2 * A_LENGTH * B_LENGTH ; float angle = std::acos(abc/twoAB); strText.Format(_T("当前角度为:%.3f度"),(angle/ 3.141 5926 * 180.0f)); pAngleStatic->SetWindowText(strText); Gdiplus::Point tempApoint = m_BPoint; tempApoint.X = tempApoint.X + A_LENGTH; float x = std::cos(angle)*A_LENGTH; float y = std::sin(angle)*A_LENGTH; m_APoint.X = x + XCENTER; if (angle < 0 ) { m_APoint.Y = y - YCENTER ; }else { m_APoint.Y = YCENTER - y ; } 5926 * 180.0f)); pAngleStatic->SetWindowText(strText); Gdiplus::Point tempApoint = m_BPoint; tempApoint.X = tempApoint.X + A_LENGTH; float x = std::cos(angle)*A_LENGTH; float y = std::sin(angle)*A_LENGTH; m_APoint.X = x + XCENTER; if (angle < 0 ) { m_APoint.Y = y - YCENTER ; }else { m_APoint.Y = YCENTER - y ; }
用户评论