%\NeedsTeXFormat{LaTeX2e}
%\typeout{Option Style�eqbgraph�f2005 July 29 by T. Moonlight}
%\typeout{......................main style +qbgraph++++++++++}
\typeout{                       sub style         +qbgraphg+  area}
%
\newcommand{\qbareaunitsq}[4]{ % #1<x<#1+1,#2<y<#2+1 �̗̈���X��#3�̎ΐ���#4�̊Ԋu�œh��
\Add{#1}{1}{\tmpaRx}
\Add{#2}{1}{\tmpaTy}
%\typeout{#1:\tmpaRx:#2:\tmpaTy:#3:#4}
\qbarea{#1}{\tmpaRx}{#2}{\tmpaTy}{#3}{#4}
}
\newcommand{\qbarea}[6]{ % #1<x<#2,#3<y<#4 �̗̈���X��#5�̎ΐ���#6�̊Ԋu�œh��
\ifdim #1 pt =#2 pt \typeout{*** \qbgraph style Hold Nothing!! ***} \else
\ifdim #3 pt =#4 pt \typeout{**** \qbgraph style Hold Nothing!! ****} \else
\qbabsd{#3}{#4}{\tmpHD} \Div{\tmpHD}{2}{\tmpHD} \Div{\tmpHD}{#5}{\tmpHD} \qbabs{\tmpHD}{\tmpHD}
\Add{#3}{#4}{\tmpLy} \Div{\tmpLy}{2}{\tmpLy} \Div{\tmpLy}{#5}{\tmpLy}
\Sub{#1}{\tmpHD}{\tmpLx} \Sub{\tmpLx}{\tmpLy}{\tmpLx} \Div{\tmpLx}{#6}{\tmpLx}
\qbint{\tmpLx}{\tmpLx} \Sub{\tmpLx}{1}{\tmpLx} \Mul{\tmpLx}{#6}{\tmpLx}
\Add{#2}{\tmpHD}{\tmpRx} \Sub{\tmpRx}{\tmpLy}{\tmpRx} \Div{\tmpRx}{#6}{\tmpRx}
\qbint{\tmpRx}{\tmpRx} \Add{\tmpRx}{1}{\tmpRx} \Mul{\tmpRx}{#6}{\tmpRx}
\qbdef{0}{\tmpLy}
\Add{\tmpLy}{#5}{\tmpLyy}
{
\loop
%   \typeout{\tmpLx < \tmpRx}
   \ifdim \tmpLx pt < \tmpRx pt
      \Add{\tmpLx}{1}{\tmpLxx}
%    \qblinee{\tmpLx}{\tmpLy}{\tmpLxx}{\tmpLyy}{10}
      \qbcrosspoint{#1}{#3}{#1}{#4}{\tmpLx}{\tmpLy}{\tmpLxx}{\tmpLyy}
      \ifdim \tmpina pt = 1 pt 
%       \qbtmppointo
         \qbdefp{\tmpx}{\tmpy}{\tmpSx}{\tmpSy}
         \qbcrosspoint{#1}{#3}{#2}{#3}{\tmpLx}{\tmpLy}{\tmpLxx}{\tmpLyy}
         \qbdef{1}{\tmpeq}
         \ifdim \tmpx pt=\tmpSx pt
            \ifdim \tmpy pt=\tmpSy pt \qbdef{0}{\tmpeq} \fi
         \fi
         \Mul{\tmpeq}{\tmpina}{\tmpeq}
         \ifdim \tmpeq pt = 1 pt
%          \qbtmppointx
            \qbtmpdefp{\tmpTx}{\tmpTy}
            \qblined{\tmpTx}{\tmpTy}{\tmpSx}{\tmpSy}
         \else
            \qbcrosspoint{#1}{#4}{#2}{#4}{\tmpLx}{\tmpLy}{\tmpLxx}{\tmpLyy}
            \qbdef{1}{\tmpeq}
            \ifdim \tmpx pt=\tmpSx pt
               \ifdim \tmpy pt=\tmpSy pt \qbdef{0}{\tmpeq} \fi
            \fi
            \Mul{\tmpeq}{\tmpina}{\tmpeq}
            \ifdim \tmpeq pt = 1 pt
%            \ifdim \tmpina pt = 1 pt
               \qbtmpdefp{\tmpTx}{\tmpTy}
               \qblined{\tmpTx}{\tmpTy}{\tmpSx}{\tmpSy}
            \else
               \qbcrosspoint{#2}{#3}{#2}{#4}{\tmpLx}{\tmpLy}{\tmpLxx}{\tmpLyy}
               \qbdef{1}{\tmpeq}
               \ifdim \tmpx pt=\tmpSx pt
                  \ifdim \tmpy pt=\tmpSy pt \qbdef{0}{\tmpeq} \fi
               \fi
               \Mul{\tmpeq}{\tmpina}{\tmpeq}
               \ifdim \tmpeq pt = 1 pt
                  \qbtmpdefp{\tmpTx}{\tmpTy}
                  \qblined{\tmpTx}{\tmpTy}{\tmpSx}{\tmpSy}
               \fi
            \fi
         \fi 
      \else
         \qbcrosspoint{#1}{#3}{#2}{#3}{\tmpLx}{\tmpLy}{\tmpLxx}{\tmpLyy}
         \ifdim \tmpina pt = 1 pt
            \qbtmpdefp{\tmpSx}{\tmpSy}
%          \qbtmppoint
            \qbcrosspoint{#1}{#4}{#2}{#4}{\tmpLx}{\tmpLy}{\tmpLxx}{\tmpLyy}
            \ifdim \tmpina pt = 1 pt
               \qbtmpdefp{\tmpTx}{\tmpTy}
               \qblined{\tmpTx}{\tmpTy}{\tmpSx}{\tmpSy}
            \else
               \qbcrosspoint{#2}{#3}{#2}{#4}{\tmpLx}{\tmpLy}{\tmpLxx}{\tmpLyy}
               \ifdim \tmpina pt = 1 pt
                  \qbtmpdefp{\tmpTx}{\tmpTy}
                  \qblined{\tmpTx}{\tmpTy}{\tmpSx}{\tmpSy}
               \fi
            \fi
         \else
            \qbcrosspoint{#1}{#4}{#2}{#4}{\tmpLx}{\tmpLy}{\tmpLxx}{\tmpLyy}
            \ifdim \tmpina pt = 1 pt
%            \qbtmppoint
               \qbtmpdefp{\tmpSx}{\tmpSy}
               \qbcrosspoint{#2}{#3}{#2}{#4}{\tmpLx}{\tmpLy}{\tmpLxx}{\tmpLyy}
               \ifdim \tmpina pt = 1 pt
                  \qbtmpdefp{\tmpTx}{\tmpTy}
                  \qblined{\tmpTx}{\tmpTy}{\tmpSx}{\tmpSy}
               \fi
            \fi
         \fi
      \fi
%   \fi   
   \Add{\tmpLx}{#6}{\tmpLx}
%   \typeout{\tmpLx}
\repeat
\fi\fi
}}
\newcommand{\qbcirclearea}[5]{% ���S(#1,#2)���a#3�̉~�̓�����#4�x�̖@���̎ΐ���#5���݂œh��B
   \Add{#4}{180}{\tmpT} \qbdef{0}{\tmpr}
   \loop
   \ifdim \tmpr pt<#3 pt
   \qbcirclechode{#1}{#2}{#3}{\tmpr}{#4}
   \qbcirclechode{#1}{#2}{#3}{\tmpr}{\tmpT}
   \Add{\tmpr}{#5}{\tmpr}
   \repeat
}
\newcommand{\qbcircleareadot}[5]{% ���S(#1,#2)���a#3�̉~�̓�����#4�x�̖@���̎ΐ���#5���݂œh��B
   \Add{#4}{180}{\tmpT} \qbdef{0}{\tmpr}
   \loop
   \ifdim \tmpr pt<#3 pt
   \qbcirclechodedot{#1}{#2}{#3}{\tmpr}{#4}
   \qbcirclechodedot{#1}{#2}{#3}{\tmpr}{\tmpT}
   \Add{\tmpr}{#5}{\tmpr}
   \repeat
}
\newcommand{\qbcircleareac}[5]{% ���S(#1,#2)���a#3�̉~�̓�����#4�x�̖@���̎ΐ���#5���݂œh��B
   \qbcirc{#1}{#2}{#3}
   \qbcirclearea{#1}{#2}{#3}{#4}{#5}
}
\newcommand{\qbtriarea}[8]{% (#1,#2),(#3,#4),(#5,#6)�̎O�_�𒸓_�Ƃ���O�p�`�̓������X��#7�̎ΐ���#8�Ԋu�œh��B
%\qbdefp{#7}{#8}{\tmpSD}{\tmpDD}
\qbgetverticallinep{#1}{#2}{0}{0}{1}{#7}{\tmpvx}{\tmpvy}
% \qbtmppoint
\qbdist{\tmpvx}{\tmpvy}{#1}{#2}{\tmpAd}
\qbgetverticallinep{#3}{#4}{0}{0}{1}{#7}{\tmpvx}{\tmpvy}
% \qbtmppoint
\qbdist{\tmpvx}{\tmpvy}{#3}{#4}{\tmpBd}
\qbgetverticallinep{#5}{#6}{0}{0}{1}{#7}{\tmpvx}{\tmpvy}
% \qbtmppoint
\qbdist{\tmpvx}{\tmpvy}{#5}{#6}{\tmpCd}
\qbdef{\tmpAd}{\tmpD}
\ifdim \tmpBd pt > \tmpD pt \qbdef{\tmpBd}{\tmpD} \fi
\ifdim \tmpCd pt > \tmpD pt \qbdef{\tmpCd}{\tmpD} \fi
\qbmam{1}{1}{#7}{#7}{\tmpDC} \Sqroot{\tmpDC}{\tmpDC}
\Div{\tmpDC}{#7}{\tmpDC}
\ifdim \tmpDC pt <0 pt \Mul{\tmpDC}{-1}{\tmpDC} \fi
\Mul{\tmpD}{\tmpDC}{\tmpD} \Div{\tmpD}{#8}{\tmpDC}
% \put(0,0){\tmpDC \tmpD}
% \qbpointo{\tmpD}{0}
\qbint{\tmpDC}{\tmpDC} \Add{\tmpDC}{1}{\tmpDC}
\Mul{\tmpDC}{#8}{\tmpRx} \Mul{\tmpRx}{-1}{\tmpLx}
% \qbpointo{\tmpLx}{0}
{
\loop
%   \typeout{\tmpLx < \tmpRx}
   \ifdim \tmpLx pt < \tmpRx pt
   \Add{\tmpLx}{1}{\tmpLxx}
   \qbdef{0}{\tmpLy}
   \Add{\tmpLy}{#7}{\tmpLyy}
%    \qblinee{\tmpLx}{\tmpLy}{\tmpLxx}{\tmpLyy}{10}
   \qbcrosspoint{#1}{#2}{#3}{#4}{\tmpLx}{\tmpLy}{\tmpLxx}{\tmpLyy}
%   \typeout{\tmpLx}
   \ifdim \tmpina pt = 1 pt 
%       \qbtmppoint
      \qbdefp{\tmpx}{\tmpy}{\tmpSx}{\tmpSy}
      \qbcrosspoint{#5}{#6}{#3}{#4}{\tmpLx}{\tmpLy}{\tmpLxx}{\tmpLyy}
%      \typeout{*** qbtriarea :-: 1}
      \ifdim \tmpina pt = 1 pt
%      \typeout{*** qbtriarea :-: 1a}
%          \qbtmppointx
         \qbtmpdefp{\tmpTx}{\tmpTy}
%      \typeout{*** qbtriarea :-: 1aa :-:\tmpTx,:,\tmpSx,:,\tmpTy:,:\tmpSy}
         \qblined{\tmpTx}{\tmpTy}{\tmpSx}{\tmpSy}
%      \typeout{*** qbtriarea :-: 1aaa}
      \else
%      \typeout{*** qbtriarea :-: 1b}
         \qbcrosspoint{#5}{#6}{#1}{#2}{\tmpLx}{\tmpLy}{\tmpLxx}{\tmpLyy}
%      \typeout{*** qbtriarea :-: 2}
         \ifdim \tmpina pt = 1 pt
            \qbtmpdefp{\tmpTx}{\tmpTy}
            \qblined{\tmpTx}{\tmpTy}{\tmpSx}{\tmpSy}
         \fi
      \fi 
   \else
      \qbcrosspoint{#5}{#6}{#3}{#4}{\tmpLx}{\tmpLy}{\tmpLxx}{\tmpLyy}
%      \typeout{*** qbtriarea :-: 3}
      \ifdim \tmpina pt = 1 pt
         \qbdefp{\tmpx}{\tmpy}{\tmpSx}{\tmpSy}
         \qbcrosspoint{#5}{#6}{#1}{#2}{\tmpLx}{\tmpLy}{\tmpLxx}{\tmpLyy}
%      \typeout{*** qbtriarea :-: 4}
         \ifdim \tmpina pt = 1 pt
            \qbtmpdefp{\tmpTx}{\tmpTy}
            \qblined{\tmpTx}{\tmpTy}{\tmpSx}{\tmpSy}
         \fi
      \fi
   \fi   
   \Add{\tmpLx}{#8}{\tmpLx}
%   \typeout{\tmpLx}
\repeat
}
}
%
\newcommand{\qbpictareafstfun}[2]{ %y=#1x+#2�̃O���t��`���Ƃ��́C
% picture����(\tmpPicW,\tmpPicH)(\tmpPicL,\tmpPicB)��\unitlength�̒l\tmpUnitL(truemm)��ݒ肷��B
\ifdim #1 pt= 0 pt
   \qbabs{#2}{\tmpPw} \Mul{\tmpPw}{1.5}{\tmpPw}
\else
   \Div{#2}{#1}{\tmpPw} \qbabs{\tmpPw}{\tmpPw}
   \ifdim \tmpPw pt= 0 pt
      \qbdef{3}{\tmpPw}
   \fi
   \qbabs{#2}{\tmpPwo}
   \ifdim \tmpPw pt> \tmpPwo pt
      \qbdef{\tmpPw}{\tmpPwo}
   \fi
   \Mul{\tmpPwo}{1.5}{\tmpPw}
\fi
\Mul{\tmpPw}{2}{\tmpPwd} \Mul{\tmpPw}{-1}{\tmpPicL}
\Add{\tmpPwd}{2}{\tmpPicW} \Add{\tmpPwd}{2}{\tmpPicH}
      \Div{\tmpPicW}{20}{\tmpArrowL}
\Add{\tmpPicW}{\tmpArrowL}{\tmpPicWs} \Add{\tmpPicW}{\tmpArrowL}{\tmpPicHs}
\Sub{\tmpPicL}{1}{\tmpPicL} \qbdef{\tmpPicL}{\tmpPicB}
\Add{\tmpPicL}{\tmpPicW}{\tmpPicR} \Add{\tmpPicB}{\tmpPicH}{\tmpPicT}
\Div{50}{\tmpPicWs}{\tmpUnitL}
%   \Div{\tmpAw}{10}{\tmpSdx}
%   \unitlength=\tmpunitl truemm
%   \Div{\tmpAw}{8}{\tmptxtu} \Div{\tmpAw}{-6}{\tmptxtum}
}
%
\newcommand{\qbpictfstfunareaPt}[6]{ % \qbpictarea����y=#1x+#2�̍��_(#3,#4)�E�_(#5,#6)�𓾂�
   % picture�͈̗̔͂��[�ł̊֐��̒l������
   \qbdefp{\tmpPicL}{\tmpPicR}{#3}{#5}
   \qbfuncfst{#1}{#2}{#3}{#4}
   \qbfuncfst{#1}{#2}{#5}{#6}
   % y�̒l���㉺�ɊO��Ă���ꍇ�̏���
   \ifdim #4 pt> \tmpPicT pt
      \qbcrosspoint{#3}{#4}{#5}{#6}{\tmpPicL}{\tmpPicT}{\tmpPicR}{\tmpPicT}
      \qbtmpdefp{#3}{#4} \qbdef{\tmpPicT}{#4}
   \fi
   \ifdim #4 pt< \tmpPicB pt
      \qbcrosspoint{#3}{#4}{#5}{#6}{\tmpPicL}{\tmpPicB}{\tmpPicR}{\tmpPicB}
      \qbtmpdefp{#3}{#4} \qbdef{\tmpPicB}{#4}
   \fi
   \ifdim #6 pt> \tmpPicT pt
      \qbcrosspoint{#3}{#4}{#5}{#6}{\tmpPicL}{\tmpPicT}{\tmpPicR}{\tmpPicT}
      \qbtmpdefp{#5}{#6} \qbdef{\tmpPicT}{#6}
   \fi
   \ifdim #6 pt< \tmpPicB pt
      \qbcrosspoint{#3}{#4}{#5}{#6}{\tmpPicL}{\tmpPicB}{\tmpPicR}{\tmpPicB}
      \qbtmpdefp{#5}{#6} \qbdef{\tmpPicB}{#6}
   \fi
}
%
\newcommand{\qbpictfstfun}[2]{ % \qbpictarea����y=#1x+#2�̃O���t��`��
   \qbpictfstfunareaPt{#1}{#2}{\tmpFlx}{\tmpFly}{\tmpFrx}{\tmpFry}
   \qbline{\tmpFlx}{\tmpFly}{\tmpFrx}{\tmpFry}
}
%
\newcommand{\qbpictfstfunareaUp}[4]{ % \qbpictarea����y>#1x+#2�̗̈��h��
   \qbpictfstfunareaPt{#1}{#2}{\tmpFlx}{\tmpFly}{\tmpFrx}{\tmpFry}
   \qbline{\tmpFlx}{\tmpFly}{\tmpFrx}{\tmpFry}
   \qbgetmidpoint{\tmpFlx}{\tmpFly}{\tmpFrx}{\tmpFry}{\tmpFmx}{\tmpFmy}
   % �܂��Apicture�͈͓̔��Œ����̏㑤��h��B
   \qbpoint{\tmpFlx}{\tmpFly}   \qbpoint{\tmpFrx}{\tmpFry}   \qbpoint{\tmpFmx}{\tmpFmy}

   \qbpictareaS{\tmpFmx}{\tmpFmy}{\tmpFrx}{\tmpFry}{\tmpFlx}{\tmpFly}{#3}{#4}
}
\newcommand{\qbpictfstfunareaDn}[4]{ % \qbpictarea����y>#1x+#2�̗̈��h��
   \qbpictfstfunareaPt{#1}{#2}{\tmpFlx}{\tmpFly}{\tmpFrx}{\tmpFry}
   \qbline{\tmpFlx}{\tmpFly}{\tmpFrx}{\tmpFry}
   \qbgetmidpoint{\tmpFlx}{\tmpFly}{\tmpFrx}{\tmpFry}{\tmpFmx}{\tmpFmy}
   % �܂��Apicture�͈͓̔��Œ����̏㑤��h��B
   \qbpoint{\tmpFlx}{\tmpFly}   \qbpoint{\tmpFrx}{\tmpFry}   \qbpoint{\tmpFmx}{\tmpFmy}

   \qbpictareaS{\tmpFmx}{\tmpFmy}{\tmpFlx}{\tmpFly}{\tmpFrx}{\tmpFry}{#3}{#4}
}
% picture�̈���̓_�ƁC����2�_���w�肷��ƁC������h��
\newcommand{\qbpictareaS}[8]{ % picture���̓_(#1,#2)�Ɖ���̓_(#3,#4),(#5,#6)�����Ԑ��������E�ɁA�͂��܂ꂽ������h��Ԃ��B
%   \qbline{#1}{#2}{#3}{#4}
%   \qbline{#1}{#2}{#5}{#6}
   \qbdef{0}{\tmpgoal}
   \qbdefp{#3}{#4}{\tmpCNx}{\tmpCNy}
%\typeout{qbpictareaS,,,\tmpCNx,:,\tmpCNy,:,\tmpPicT,:,\tmpPicR}
   \loop
   \ifdim \tmpgoal pt=0.0 pt
      \qbpictareaSnxtcnrsrch{\tmpCNx}{\tmpCNy}{#5}{#6}{\tmpNCNx}{\tmpNCNy}{\tmpgoal}
      \qbtriarea{#1}{#2}{\tmpCNx}{\tmpCNy}{\tmpNCNx}{\tmpNCNy}{#7}{#8}
      \qbdefp{\tmpNCNx}{\tmpNCNy}{\tmpCNx}{\tmpCNy}
%      \typeout{\tmpNCNx,:,\tmpNCNy,:,\tmpgoal}
   \repeat
%\typeout{*****out***}
}
\newcommand{\qbpictareaSnxtcnrsrch}[7]{ %(#1,#2)���甽���v���ɉ����T��C
% (#3,#4)�ɊY������� #7��1��Ԃ�
% �Y�����Ȃ���΁C���̃R�[�i�[��(#5,#6)�ɕԂ��B
\ifdim #1 pt= \tmpPicL pt
   \ifdim #2 pt>\tmpPicB pt
      \ifdim #3 pt=\tmpPicL pt
         \ifdim #2 pt>#4 pt
            \qbdef{1}{#7}
            \qbdefp{#3}{#4}{#5}{#6}
         \else
            \qbdefp{\tmpPicL}{\tmpPicB}{#5}{#6}
         \fi  
      \else
         \qbdefp{\tmpPicL}{\tmpPicB}{#5}{#6}
      \fi
   \fi
\fi
\ifdim #2 pt=\tmpPicB pt
   \ifdim #1 pt< \tmpPicR pt
      \ifdim #4 pt=\tmpPicB pt
         \ifdim #1 pt< #3 pt
            \qbdef{1}{#7}
            \qbdefp{#3}{#4}{#5}{#6}
         \else
            \qbdefp{\tmpPicR}{\tmpPicB}{#5}{#6}
         \fi
      \else
         \qbdefp{\tmpPicR}{\tmpPicB}{#5}{#6}
      \fi
   \fi
\fi
\ifdim #1 pt=\tmpPicR pt
   \ifdim #2 pt<\tmpPicT pt
      \ifdim #3 pt=\tmpPicR pt
         \ifdim #2 pt<#4 pt
            \qbdef{1}{#7}
            \qbdefp{#3}{#4}{#5}{#6}
         \else
            \qbdefp{\tmpPicR}{\tmpPicT}{#5}{#6}
         \fi
      \else
         \qbdefp{\tmpPicR}{\tmpPicT}{#5}{#6}
      \fi
   \fi
\fi
\ifdim #2 pt=\tmpPicT pt
   \ifdim #1 pt>\tmpPicL pt
      \ifdim #4 pt=\tmpPicT pt
         \ifdim #3 pt<#1 pt
            \qbdef{1}{#7}
            \qbdefp{#3}{#4}{#5}{#6}
         \else
            \qbdefp{\tmpPicL}{\tmpPicT}{#5}{#6}
         \fi
      \else
         \qbdefp{\tmpPicL}{\tmpPicT}{#5}{#6}
      \fi
   \fi
\fi
}
%
\endinput
% �����܂ł��}�N���B�ȉ��ᕶ�B