Option Explicit
Option Base 0
'
Const CONSTPAI As Double = 3.14159265358979 'π
'
Const CCCCSXPT As Integer = 200 '描画開始位置X
Const CCCCSYPT As Integer = 135 ' Y
Const CCCCLENG As Integer = 4 '最小マス一辺の長さ
Const CCCCORDR As Integer = 10 '次数
Const CCCCLNCL As Long = &H3C14DC '線の色(Crimson)
Const CCCCLNWT As Single = 1 '線の太さ
'---------------------------------------------------------------
Public p_intDxp As Integer '描画位置X(変数)
Public p_intDyp As Integer ' Y(変数)
Public p_intAng As Integer '描画角度 (変数)
'*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Public Sub C曲線描画マクロ()
'
p_intDxp = CCCCSXPT: p_intDyp = CCCCSYPT
p_intAng = 0
Call C曲線描画マクロ_回帰(CCCCORDR)
End Sub
'*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Public Sub C曲線描画マクロ_回帰(pintNum As Integer)
Dim intExp As Integer, intEyp As Integer
Dim dblRad As Double
'
If pintNum = 0 Then
dblRad = p_intAng * CONSTPAI / 180
intExp = p_intDxp - CCCCLENG * Cos(dblRad)
intEyp = p_intDyp + CCCCLENG * Sin(dblRad)
With ActiveDocument.Shapes.AddLine( _
p_intDxp, p_intDyp, intExp, intEyp).Line
.ForeColor.RGB = CCCCLNCL '←線色
.Weight = CCCCLNWT '←線の太さ
End With
p_intDxp = intExp: p_intDyp = intEyp
'↓時間がかかるので、挿入しました。
DoEvents
Else
Call C曲線描画マクロ_回帰(pintNum - 1)
p_intAng = p_intAng + 90
Call C曲線描画マクロ_回帰(pintNum - 1)
p_intAng = p_intAng - 90
End If
End Sub