none
원의 방정식 RRS feed

  • 질문

  • X,Y를 엑셀에서 구할수 있을까요

    <아무도 안아려 주어 cad로 두원을 그린후 교점을 찿았습니다>

     Public Function 교차점(좌표x1, 좌표y1, 반지름1, 좌표x2, 좌표y2, 반지름2)
            Dim arcObj1 As AcadArc
            Dim arcObj2 As AcadArc
            Dim centerPoint(0 To 2) As Double
            Dim radius As Double
            Dim startAngleInDegree As Double
            Dim endAngleInDegree As Double

            centerPoint(0) = 좌표x1 :        centerPoint(1) = 좌표y1 :        centerPoint(2) = 0 :        radius = 반지름1

            startAngleInDegree = 0 :        endAngleInDegree = 359 '끝각

            Dim startAngleInRadian As Double
            Dim endAngleInRadian As Double
            startAngleInRadian = startAngleInDegree * 3.141592 / 180
            endAngleInRadian = endAngleInDegree * 3.141592 / 180

            ' 첫번째 호그리기
            arcObj1 = moSpace.AddArc(centerPoint, radius, startAngleInRadian, endAngleInRadian)
    '======================================================================================
            ' 두번째 호그리기
            centerPoint(0) = 좌표x2 :        centerPoint(1) = 좌표y2 :        centerPoint(2) = 0:        radius = 반지름2

            startAngleInDegree = 0 :       endAngleInDegree = 359 '끝각

            startAngleInRadian = startAngleInDegree * 3.141592 / 180
            endAngleInRadian = endAngleInDegree * 3.141592 / 180

            ' 두번째 호그리기
            arcObj2 = moSpace.AddArc(centerPoint, radius, startAngleInRadian, endAngleInRadian)

            ' 교차점 읽어 오기
            Dim intpoints As Object
            intpoints = arcObj1.IntersectWith(arcObj2, AcExtendOption.acExtendNone) 'acExtendNone)

            ' 모든교차점 읽어 오기
            Dim i As Integer, j As Integer, k As Integer
            Dim str As String

          '==확인 하고져================================
            If VarType(intpoints) <> vbEmpty Then
                For i = LBound(intpoints) To UBound(intpoints)
                    str = "" & k & ", x= " & _
                         intpoints(j) & ",y= " & _
                         intpoints(j + 1) & ", z= " & _
                         intpoints(j + 2)
                    i = i + 2
                    j = j + 3
                    k = k + 1
                Next
            End If

          '==================================

            '교점이 2개일때 1. y 가 큰것을 취하고
            '                     2. y 가 작을때는 x가 큰것을 취한다.
            Dim 좌표(2) As Double
            If intpoints(1) > intpoints(4) Then
                좌표(0) = intpoints(0)
                좌표(1) = intpoints(1)
            Else
                If intpoints(0) > intpoints(3) Then
                    좌표(0) = intpoints(0)
                    좌표(1) = intpoints(1)
                Else
                    좌표(0) = intpoints(3)
                    좌표(1) = intpoints(4)
                End If
            End If

            arcObj1.Delete() :        arcObj2.Delete()

            Return (좌표)

        End Function

    • 편집됨 박희철 2016년 5월 3일 화요일 오전 5:48
    2016년 4월 29일 금요일 오전 3:27