%\NeedsTeXFormat{LaTeX2e}
%\typeout{Option Style‘qbgraph’2005 July 29 by T. Moonlight}
%\typeout{......................main style +qbgraph++++++++++}
\typeout{                       sub style         +qbgraphb+ point rotation crosspoint label etc...}
%
% 点を黒丸で描く
\newcommand{\qbpointg}[2]{
\rval=#1pt\rval=#2pt
%\Div{1\unitlength}{5truemm}{\tmpPR}
%\Div{.2}{\tmpPR}{\tmpPR}}
\put(#1,#2){\circle*{0.075}}
\qbdefptmp{#1}{#2}
}
\newcommand{\qbpictpoint}[2]{
%\rval=#1pt\rval=#2pt
\Div{\tmpPicW}{100}{\tmpCR}
%\Div{.2}{\tmpPR}{\tmpPR}}
\put(#1,#2){\circle*{\tmpCR}}
\qbdefptmp{#1}{#2}
}
\newcommand{\qbpictpointo}[2]{
%\rval=#1pt\rval=#2pt
\Div{\tmpPicW}{100}{\tmpCR}
%\Div{.2}{\tmpPR}{\tmpPR}}
\put(#1,#2){\circle{\tmpCR}}
\qbdefptmp{#1}{#2}
}
%
\newcommand{\qbpointval}[2]{
\rval=#1pt\rval=#2pt
\tmpUnitL=\unitlength
% \strip@pt#1 は寸法変数#1のptを外してくれる。
\qbdef{2}{\tmpptsize}
\Div{\tmpptsize}{\strip@pt\tmpUnitL}{\tmpptsize}
%\tmpUnitL 
\tmpptsize
}
\newcommand{\qbunitval}[1]{
\tmpUnitL=\unitlength
\qbdef{\strip@pt\tmpUnitL}{#1}
}
%
\newcommand{\qbputtxt}[3]{%　(#1,#2)に（上下左右）中揃えで text #3を描く
\qbtxtsize{#3}{\tmpTw}{\tmpTh}{\tmpTd}  %表示するテキストのサイズを取得
\Sub{\tmpTh}{\tmpTd}{\tmpTh}
\Div{\tmpTw}{2}{\tmpTwh} \Sub{#1}{\tmpTwh}{\tmpx}
\Div{\tmpTh}{2}{\tmpThh} \Sub{#2}{\tmpThh}{\tmpy}
\put(\tmpx,\tmpy){#3}
}%
%
\newcommand{\qbpoint}[2]{
\rval=#1pt\rval=#2pt
\tmpUnitL=\unitlength
% \strip@pt#1 は寸法変数#1のptを外してくれる。
\qbdef{2}{\tmpptsize}
\Div{\tmpptsize}{\strip@pt\tmpUnitL}{\tmpptsize}
\put(#1,#2){\circle*{\tmpptsize}}
\qbdefptmp{#1}{#2}
}
\newcommand{\qbpointd}[2]{
\rval=#1pt\rval=#2pt
\tmpUnitL=\unitlength
% \strip@pt#1 は寸法変数#1のptを外してくれる。
\qbdef{1}{\tmpptsize}
\Div{\tmpptsize}{\strip@pt\tmpUnitL}{\tmpptsize}
\put(#1,#2){\circle*{\tmpptsize}}
\qbdefptmp{#1}{#2}
}
\newcommand{\qbtmppoint}[0]{
\qbpoint{\tmpx}{\tmpy}
}
\newcommand{\qbpointb}[2]{%
\rval=#1pt\rval=#2pt
\tmpUnitL=\unitlength
\qbdef{3}{\tmpptsize}
\Div{\tmpptsize}{\strip@pt\tmpUnitL}{\tmpptsize}
\put(#1,#2){\circle*{\tmpptsize}}
\qbdefptmp{#1}{#2}
}
\newcommand{\qbpointB}[2]{%
\rval=#1pt\rval=#2pt
\tmpUnitL=\unitlength
\qbdef{4}{\tmpptsize}
\Div{\tmpptsize}{\strip@pt\tmpUnitL}{\tmpptsize}
\put(#1,#2){\circle*{\tmpptsize}}
\qbdefptmp{#1}{#2}
}
\newcommand{\qbpointo}[2]{
\rval=#1pt\rval=#2pt
\tmpUnitL=\unitlength
\qbdef{3}{\tmpptsize}
\Div{\tmpptsize}{\strip@pt\tmpUnitL}{\tmpptsize}
\put(#1,#2){\circle{\tmpptsize}}
\qbdefptmp{#1}{#2}
}
\newcommand{\qbpointO}[2]{
\rval=#1pt\rval=#2pt
\tmpUnitL=\unitlength
\qbdef{4}{\tmpptsize}
\Div{\tmpptsize}{\strip@pt\tmpUnitL}{\tmpptsize}
\put(#1,#2){\circle{\tmpptsize}}
\qbdefptmp{#1}{#2}
}
\newcommand{\qbpointOo}[2]{
\rval=#1pt\rval=#2pt
\tmpUnitL=\unitlength
\qbdef{4}{\tmpptsize}
\Div{\tmpptsize}{\strip@pt\tmpUnitL}{\tmpptsize}
\put(#1,#2){\circle{\tmpptsize}}
\Div{\tmpptsize}{2}{\tmpptsize}
\put(#1,#2){\circle{\tmpptsize}}
\qbdefptmp{#1}{#2}
}
\newcommand{\qbtmppointb}[0]{\qbpointb{\tmpx}{\tmpy}}
\newcommand{\qbtmppointB}[0]{\qbpointB{\tmpx}{\tmpy}}
\newcommand{\qbtmppointo}[0]{\qbpointo{\tmpx}{\tmpy}}
\newcommand{\qbtmppointO}[0]{\qbpointO{\tmpx}{\tmpy}}
\newcommand{\qbtmppointOo}[0]{\qbpointOo{\tmpx}{\tmpy}}
\newcommand{\qbpointx}[2]{
\rval=#1pt\rval=#2pt
\tmpUnitL=\unitlength
\qbdef{1.7}{\tmpptsize}
\Div{\tmpptsize}{\strip@pt\tmpUnitL}{\tmpptsize}
\Sub{#1}{\tmpptsize}{\tmplx}
\Add{#1}{\tmpptsize}{\tmprx}
\Sub{#2}{\tmpptsize}{\tmpby}
\Add{#2}{\tmpptsize}{\tmpty}
\qbezier(\tmplx,\tmpty)(#1,#2)(\tmprx,\tmpby)
\qbezier(\tmplx,\tmpby)(#1,#2)(\tmprx,\tmpty)
\qbdefptmp{#1}{#2}
}
\newcommand{\qbpointX}[2]{
\rval=#1pt\rval=#2pt
\tmpUnitL=\unitlength
\qbdef{3.5}{\tmpptsize}
\Div{\tmpptsize}{\strip@pt\tmpUnitL}{\tmpptsize}
\Sub{#1}{\tmpptsize}{\tmplx}
\Add{#1}{\tmpptsize}{\tmprx}
\Sub{#2}{\tmpptsize}{\tmpby}
\Add{#2}{\tmpptsize}{\tmpty}
\qbezier(\tmplx,\tmpty)(#1,#2)(\tmprx,\tmpby)
\qbezier(\tmplx,\tmpby)(#1,#2)(\tmprx,\tmpty)
\qbdefptmp{#1}{#2}
}
\newcommand{\qbtmppointx}[0]{\qbpointx{\tmpx}{\tmpy}}
\newcommand{\qbtmppointX}[0]{\qbpointX{\tmpx}{\tmpy}}
\newcommand{\qbpointp}[2]{
\rval=#1pt\rval=#2pt
\Sub{#1}{0.15}{\tmplx}
\Add{#1}{0.15}{\tmprx}
\Sub{#2}{0.15}{\tmpby}
\Add{#2}{0.15}{\tmpty}
\qbezier(\tmplx,#2)(#1,#2)(\tmprx,#2)
\qbezier(#1,\tmpby)(#1,#2)(#1,\tmpty)
\qbdefptmp{#1}{#2}
}
\newcommand{\qbpointpp}[2]{
\rval=#1pt\rval=#2pt
\Sub{#1}{0.05}{\tmplx}
\Add{#1}{0.05}{\tmprx}
\Sub{#2}{0.05}{\tmpby}
\Add{#2}{0.05}{\tmpty}
\qbezier(\tmplx,#2)(#1,#2)(\tmprx,#2)
\qbezier(#1,\tmpby)(#1,#2)(#1,\tmpty)
\qbdefptmp{#1}{#2}
}
\newcommand{\qbtmppointp}[0]{
\qbpointp{\tmpx}{\tmpy}
}
%\newcommand{\qbtmppointo}[0]{\qbpointo{\tmpx}{\tmpy}}
% 点にラベルを打つ
\newcommand{\qbplabel}[6]{% (#1,#2): 基本の点の座標 #3:txt #4:dir(0-11) #5:dummy #6:dist
\rval=#1pt\rval=#2pt\rval=#4pt
\rval=#5pt\rval=#6pt
\Mul{#4}{30}\tmppx
\Mul{#4}{30}\tmppy
\qbcos\tmppx\tmppx
\qbsin\tmppy\tmppy
\Mul\tmppx{#6}\tmppx
\Mul\tmppy{#6}\tmppy
\Add\tmppx{#1}\tmppx
%\Sub\tmppx{#5}\tmppx
\Add\tmppy{#2}\tmppy
%\Sub\tmppy{#5}\tmppy
\qbputtxt{\tmppx}{\tmppy}{#3}
}
\newcommand{\qbtmplabel}[4]{
\qbplabel{\tmpx}{\tmpy}{#1}{#2}{#3}{#4}
}
\newcommand{\qblinelabel}[5]{
   \qbgetmidpoint{#1}{#2}{#3}{#4}{\tmpMx}{\tmpMy}
   \qbrotpoint{\tmpMx}{\tmpMy}{#1}{#2}{90}
%   \qbtmpline{\tmpMx}{\tmpMy}
   \Sub{\tmpx}{\tmpMx}{\tmpDx}   \Sub{\tmpy}{\tmpMy}{\tmpDy}
   \qbdist{0}{0}{\tmpDx}{\tmpDy}{\tmpD}
   \qbunitval{\tmpUv} \Div{\tmpUv}{8}{\tmpUv}
   \Mul{\tmpD}{\tmpUv}{\tmpD}
   \Div{\tmpDx}{\tmpD}{\tmpDx}   \Div{\tmpDy}{\tmpD}{\tmpDy}
   \Add{\tmpMx}{\tmpDx}{\tmpLBx} \Add{\tmpMy}{\tmpDy}{\tmpLBy}
%   \qbpoint{\tmpLBx}{\tmpLBy}
%%   \Div{0.3}{\tmpUv}{\tmpUv}
%%   \Sub{\tmpLBx}{\tmpUv}{\tmpLBx}
%%   \Sub{\tmpLBy}{\tmpUv}{\tmpLBy}
%   \Sub{\tmpLBx}{0.2}{\tmpLBx}
%   \Sub{\tmpLBy}{0.2}{\tmpLBy}
%   \qbpointp{\tmpLBx}{\tmpLBy}
   \qbputtxt{\tmpLBx}{\tmpLBy}{#5}
}
\newcommand{\qblinelabelb}[5]{
   \qbgetmidpoint{#1}{#2}{#3}{#4}{\tmpMx}{\tmpMy}
   \qbrotpoint{\tmpMx}{\tmpMy}{#1}{#2}{90}
%   \qbtmpline{\tmpMx}{\tmpMy}
   \Sub{\tmpx}{\tmpMx}{\tmpDx}   \Sub{\tmpy}{\tmpMy}{\tmpDy}
   \qbdist{0}{0}{\tmpDx}{\tmpDy}{\tmpD} \Mul{\tmpD}{1.3}{\tmpDD} \typeout{\tmpD}
   \Div{\tmpDx}{\tmpD}{\tmpDx}   \Div{\tmpDy}{\tmpD}{\tmpDy}
   \Div{\tmpDx}{\tmpDD}{\tmpDDx}   \Div{\tmpDy}{\tmpDD}{\tmpDDy}
   \Add{\tmpMx}{\tmpDx}{\tmpLBx} \Add{\tmpMy}{\tmpDy}{\tmpLBy}
   \Add{\tmpMx}{\tmpDDx}{\tmpLBBx} \Add{\tmpMy}{\tmpDDy}{\tmpLBBy}
   \Add{#1}{\tmpDDx}{\tmpLBAx} \Add{#2}{\tmpDDy}{\tmpLBAy}
   \Add{#3}{\tmpDDx}{\tmpLBCx} \Add{#4}{\tmpDDy}{\tmpLBCy}
   \qbezier(#1,#2)(\tmpLBAx,\tmpLBAy)(\tmpLBBx,\tmpLBBy)
   \qbezier(#3,#4)(\tmpLBCx,\tmpLBCy)(\tmpLBBx,\tmpLBBy)
%   \Sub{\tmpLBx}{0.2}{\tmpLBx}
%   \Sub{\tmpLBy}{0.2}{\tmpLBy}
%   \qbpointp{\tmpLBx}{\tmpLBy}
   \qbputtxt{\tmpLBx}{\tmpLBy}{#5}
}
%
%回転点
\newcommand{\qbrotpoint}[5]{ %(#1,#2)を中心に(#3,#4)を#5度回転した点を(\tmpx,\tmpy)に返す
\rval=#1pt\rval=#2pt\rval=#3pt\rval=#4pt\rval=#5pt
\Sub{#3}{#1}{\tmpVx}
\Sub{#4}{#2}{\tmpVy}     %\typeout{\tmpvx + \tmpvy}
\qbsin{#5}{\tmpRS}
\qbcos{#5}{\tmpRC}    % \typeout{\tmps + \tmpc}
\qbmsm{\tmpRC}{\tmpVx}{\tmpRS}{\tmpVy}{\tmpRx}
\qbmam{\tmpRS}{\tmpVx}{\tmpRC}{\tmpVy}{\tmpRy}    %\typeout{\tmpx + \tmpy}
\Add{#1}{\tmpRx}{\tmpx}
\Add{#2}{\tmpRy}{\tmpy}
}
%回転点
\newcommand{\qbrotpointl}[6]{ %(#1,#2)を中心に(#3,#4)を#5度回転した点を(\tmpx,\tmpy)に返す
\rval=#1pt\rval=#2pt\rval=#3pt\rval=#4pt\rval=#5pt%
\Sub{#3}{#1}{\tmpvx}%
\Sub{#4}{#2}{\tmpvy}%     %\typeout{\tmpvx + \tmpvy}
\qbsin{#5}{\tmps}%
\qbcos{#5}{\tmpc}%    % \typeout{\tmps + \tmpc}
\qbdist{0}{0}{\tmpvx}{\tmpvy}{\tmpVL}%
\qbmsm{\tmpc}{\tmpvx}{\tmps}{\tmpvy}{\tmpx}%
\qbmam{\tmps}{\tmpvx}{\tmpc}{\tmpvy}{\tmpy}%    %\typeout{\tmpx + \tmpy}
\Div{\tmpx}{\tmpVL}{\tmpx} \Mul{\tmpx}{#6}{\tmpx}%
\Div{\tmpy}{\tmpVL}{\tmpy} \Mul{\tmpy}{#6}{\tmpy}%
\Add{#1}{\tmpx}{\tmpx}%
\Add{#2}{\tmpy}{\tmpy}%
}
%回転点
\newcommand{\qbrotunitpoint}[5]{ %(#1,#2)を中心に(#3,#4)を#5度回転した点を(\tmpx,\tmpy)に返す
\rval=#1pt\rval=#2pt\rval=#3pt\rval=#4pt\rval=#5pt
\Sub{#3}{#1}{\tmpvx}
\Sub{#4}{#2}{\tmpvy}     %\typeout{\tmpvx + \tmpvy}
\qbsin{#5}{\tmps}
\qbcos{#5}{\tmpc}    % \typeout{\tmps + \tmpc}
\qbdist{0}{0}{\tmpvx}{\tmpvy}{\tmpVL}
\qbmsm{\tmpc}{\tmpvx}{\tmps}{\tmpvy}{\tmpx}
\qbmam{\tmps}{\tmpvx}{\tmpc}{\tmpvy}{\tmpy}    %\typeout{\tmpx + \tmpy}
\Div{\tmpx}{\tmpVL}{\tmpx}
\Div{\tmpy}{\tmpVL}{\tmpy}
\Add{#1}{\tmpx}{\tmpx}
\Add{#2}{\tmpy}{\tmpy}
}
%回転点ちょっと
\newcommand{\qbrotpointmini}[7]{ %(#1,#2)を中心に(#3,#4)を#5度回転した点を(\tmpx,\tmpy)に返す
\rval=#1pt\rval=#2pt\rval=#3pt\rval=#4pt\rval=#5pt
\Sub{#3}{#1}{\tmpvx}
\Sub{#4}{#2}{\tmpvy}     %\typeout{\tmpvx + \tmpvy}
\qbsin{#5}{\tmps}
\qbcos{#5}{\tmpc}    % \typeout{\tmps + \tmpc}
\qbdist{0}{0}{\tmpvx}{\tmpvy}{\tmpVL}
\qbmsm{\tmpc}{\tmpvx}{\tmps}{\tmpvy}{\tmpx}
\qbmam{\tmps}{\tmpvx}{\tmpc}{\tmpvy}{\tmpy}    %\typeout{\tmpx + \tmpy}
\tmpUnitL=\unitlength
\qbdef{1}{\tmpptsize}
\Div{\tmpptsize}{\strip@pt\tmpUnitL}{\tmpptsize}
\Div{\tmpx}{\tmpVL}{\tmpx} \Mul{\tmpx}{\tmpptsize}{\tmpx}
\Div{\tmpy}{\tmpVL}{\tmpy} \Mul{\tmpy}{\tmpptsize}{\tmpy}
\Add{#1}{\tmpx}{#6}
\Add{#2}{\tmpy}{#7}
}
%回転点ちょっと
\newcommand{\qbrotpointminx}[8]{ %(#1,#2)を中心に(#3,#4)を#5度回転した点を(\tmpx,\tmpy)に返す
\rval=#1pt\rval=#2pt\rval=#3pt\rval=#4pt\rval=#5pt
\Sub{#3}{#1}{\tmpvx}
\Sub{#4}{#2}{\tmpvy}     %\typeout{\tmpvx + \tmpvy}
\qbsin{#5}{\tmps}
\qbcos{#5}{\tmpc}    % \typeout{\tmps + \tmpc}
\qbdist{0}{0}{\tmpvx}{\tmpvy}{\tmpVL}
\qbmsm{\tmpc}{\tmpvx}{\tmps}{\tmpvy}{\tmpx}
\qbmam{\tmps}{\tmpvx}{\tmpc}{\tmpvy}{\tmpy}    %\typeout{\tmpx + \tmpy}
\tmpUnitL=\unitlength
\qbdef{#6}{\tmpptsize}
\Div{\tmpptsize}{\strip@pt\tmpUnitL}{\tmpptsize}
\Div{\tmpx}{\tmpVL}{\tmpx} \Mul{\tmpx}{\tmpptsize}{\tmpx}
\Div{\tmpy}{\tmpVL}{\tmpy} \Mul{\tmpy}{\tmpptsize}{\tmpy}
\Add{#1}{\tmpx}{#7}
\Add{#2}{\tmpy}{#8}
}
%点の移動ちょっとだけ
\newcommand{\qbmovepointminix}[7]{
   \qbdist{#1}{#2}{#3}{#4}{\tmpVL}
   \Sub{#3}{#1}{\tmppvx}\Sub{#4}{#2}{\tmppvy}
   \Div{\tmppvx}{\tmpVL}{\tmppvx}\Div{\tmppvy}{\tmpVL}{\tmppvy}
   \tmpUnitL=\unitlength
   \qbdef{#5}{\tmpmoveptsize}
   \Div{\tmpmoveptsize}{\strip@pt\tmpUnitL}{\tmpmoveptsize}
   \Mul{\tmppvx}{\tmpmoveptsize}{\tmppvx}
   \Mul{\tmppvy}{\tmpmoveptsize}{\tmppvy}
   \Add{#1}{\tmppvx}{#6}\Add{#2}{\tmppvy}{#7}
}
%点の移動長さで指定
\newcommand{\qbmovepointdist}[7]{
   \qbdist{0}{0}{#3}{#4}{\tmpVL}
%   \Sub{#3}{#1}{\tmppvx}\Sub{#4}{#2}{\tmppvy}
   \Div{#3}{\tmpVL}{\tmppvx}\Div{#4}{\tmpVL}{\tmppvy}
%   \tmpUnitL=\unitlength
%   \qbdef{#5}{\tmpptsize}
%   \Div{\tmpptsize}{\strip@pt\tmpUnitL}{\tmpptsize}
   \Mul{\tmppvx}{#5}{\tmppvx}
   \Mul{\tmppvy}{#5}{\tmppvy}
   \Add{#1}{\tmppvx}{#6}\Add{#2}{\tmppvy}{#7}
}
%
\newcommand{\qblineseparate}[4]{
   \qbrotpointmini{#1}{#2}{#3}{#4}{90}{\tmpSPx}{\tmpSPy}
   \qbrotpointmini{#1}{#2}{#3}{#4}{270}{\tmpSQx}{\tmpSQy}
   \qbline{\tmpSPx}{\tmpSPy}{\tmpSQx}{\tmpSQy}
}
\newcommand{\qbcircseparate}[4]{
   \qbmovepointminix{#3}{#4}{#1}{#2}{1}{\tmpSPx}{\tmpSPy}
   \qbmovepointminix{#3}{#4}{#1}{#2}{-1}{\tmpSQx}{\tmpSQy}
   \qbline{\tmpSPx}{\tmpSPy}{\tmpSQx}{\tmpSQy}
}
\newcommand{\qblineseparatx}[5]{
   \qbrotpointminx{#1}{#2}{#3}{#4}{90}{#5}{\tmpSPx}{\tmpSPy}
   \qbrotpointminx{#1}{#2}{#3}{#4}{270}{#5}{\tmpSQx}{\tmpSQy}
   \qbline{\tmpSPx}{\tmpSPy}{\tmpSQx}{\tmpSQy}
}
%直角の記号
\newcommand{\qbverticalmark}[6]{%
   \qbmovepointminix{#3}{#4}{#1}{#2}{5}{\tmpVMx}{\tmpVMy}   
   \tmpUnitL=\unitlength
   \qbdef{5}{\tmpptsize}
   \Div{\tmpptsize}{\strip@pt\tmpUnitL}{\tmpptsize}
   \qbdist{#3}{#4}{#5}{#6}{\tmpML}
   \Sub{#5}{#3}{\tmppmx}\Div{\tmppmx}{\tmpML}{\tmppmx}\Mul{\tmppmx}{\tmpptsize}{\tmppmx}
   \Sub{#6}{#4}{\tmppmy}\Div{\tmppmy}{\tmpML}{\tmppmy}\Mul{\tmppmy}{\tmpptsize}{\tmppmy}
   \Add{\tmpVMx}{\tmppmx}{\tmpVGx}
   \Add{\tmpVMy}{\tmppmy}{\tmpVGy}
   \qbline{\tmpVMx}{\tmpVMy}{\tmpVGx}{\tmpVGy}
   \qbdist{#3}{#4}{#1}{#2}{\tmpML}
   \Sub{#3}{#1}{\tmppmx}\Div{\tmppmx}{\tmpML}{\tmppmx}\Mul{\tmppmx}{\tmpptsize}{\tmppmx}
   \Sub{#4}{#2}{\tmppmy}\Div{\tmppmy}{\tmpML}{\tmppmy}\Mul{\tmppmy}{\tmpptsize}{\tmppmy}
   \Add{\tmpVGx}{\tmppmx}{\tmpVMx}
   \Add{\tmpVGy}{\tmppmy}{\tmpVMy}
   \qbline{\tmpVMx}{\tmpVMy}{\tmpVGx}{\tmpVGy}
}
%交点の座標を得る
\newcommand{\qbcrosspoint}[8]{
\rval=#1pt\rval=#2pt\rval=#3pt\rval=#4pt
\rval=#5pt\rval=#6pt\rval=#7pt\rval=#8pt %\typeout{#1-#2-#3}
\Sub{#3}{#1}{\tmpbax}
\Sub{#4}{#2}{\tmpbay}
\Sub{#5}{#1}{\tmpcax}
\Sub{#6}{#2}{\tmpcay}
\Sub{#7}{#5}{\tmpdcx}
\Sub{#8}{#6}{\tmpdcy}  %\typeout{\tmpbax-\tmpbay-\tmpcax-\tmpcay-\tmpdcx-\tmpdcy}
\Mul{\tmpbay}{\tmpcax}{\tmpa}
\Mul{\tmpbax}{\tmpcay}{\tmpb}     %\typeout{\tmpa+\tmpb}
\Sub{\tmpa}{\tmpb}{\tmpc}
\Mul{\tmpbax}{\tmpdcy}{\tmpa}
\Mul{\tmpbay}{\tmpdcx}{\tmpb}
\Sub{\tmpa}{\tmpb}{\tmpd}
\Div{\tmpc}{\tmpd}{\tmps}
\Sub{1}{\tmps}{\tmpt}
\Mul{\tmpt}{#5}{\tmpcx}
\Mul{\tmps}{#7}{\tmpcxx}
\Add{\tmpcx}{\tmpcxx}{\tmpx}
\Mul{\tmpt}{#6}{\tmpcx}
\Mul{\tmps}{#8}{\tmpcxx}
\Add{\tmpcx}{\tmpcxx}{\tmpy}
\qbdef{0}{\tmpina} 
\qbdef{0}{\tmpinb}
% 線分内にあるかどうか？
\ifdim #1 pt=#3 pt
   \ifdim \qbininterval{#2}{#4}{\tmpy} pt=1 pt \qbdef{1}{\tmpina} \fi
\else
   \ifdim \qbininterval{#1}{#3}{\tmpx} pt=1 pt \qbdef{1}{\tmpina} \fi
\fi
\ifdim #5 pt=#7 pt
   \ifdim \qbininterval{#6}{#8}{\tmpy} pt=1 pt \qbdef{1}{\tmpinb} \fi
\else
   \ifdim \qbininterval{#5}{#7}{\tmpx} pt=1 pt \qbdef{1}{\tmpinb} \fi
\fi
}
%中点の座標を得る
\newcommand{\qbgetmidpoint}[6]{
\rval=#1pt\rval=#2pt\rval=#3pt\rval=#4pt
\Add{#1}{#3}\tmpxx \Div{\tmpxx}{2}{\tmpxx} 
\Add{#2}{#4}\tmpyy \Div{\tmpyy}{2}{\tmpyy} 
\Mul{\tmpxx}{1}{#5}
\Mul{\tmpyy}{1}{#6}
\Mul{\tmpxx}{1}{\tmpx}
\Mul{\tmpyy}{1}{\tmpy}
}
\newcommand{\qbmidpoint}[4]{
\qbgetmidpoint{#1}{#2}{#3}{#4}{\tmpx}{\tmpy}
\put(\tmpx,\tmpy){\circle*{.2}}
}
%分点の座標を得る
\newcommand{\qbgetdivpoint}[8]{
\rval=#1pt\rval=#2pt\rval=#3pt\rval=#4pt\rval=#5pt\rval=#6pt
\Add{#5}{#6}\tmpm %\typeout{#5,#6,\tmpm}
\Mul{#1}{#6}\tmpxx %\typeout{#1,#6,\tmpxx}
\Mul{#3}{#5}\tmpmx %\typeout{#3,#5,\tmpmx}
\Add{\tmpxx}{\tmpmx}{\tmpxx} %\typeout{\tmpxx}
\Div{\tmpxx}{\tmpm}{\tmpxx} %\typeout{\tmpxx}
\Mul{#2}{#6}\tmpyy
\Mul{#4}{#5}\tmpmy
\Add{\tmpyy}{\tmpmy}{\tmpyy}
\Div{\tmpyy}{\tmpm}{\tmpyy} %\typeout{\tmpyy}
\Mul{\tmpxx}{1}{#7}
\Mul{\tmpyy}{1}{#8}
\qbdefptmp{\tmpxx}{\tmpyy}
}
%put circle*による分点の描画
\newcommand{\qbdivpoint}[6]{
\qbgetdivpoint{#1}{#2}{#3}{#4}{#5}{#6}{\tmpx}{\tmpy}
\put(\tmpx,\tmpy){\circle*{.2}}
}
%
%
\endinput
% ここまでがマクロ。以下例文。