== Class Rod - the model of 3D-Line == [http://www.geocities.jp/classiclll_newweb/RodTest/applet/index.html test applet and codes are here] {{{ code java * Class Rod, the model of partial line on the 3D space, * spanned from it's stern to it's bow * created by Classiclll, 6/28/2008 Rod(Loc s, Loc b) // only constructor you can use Loc at(float t) // location at t, at(0):stern, at(me.length):bow Rod move(Loc to) // move stern to "to" Rod shift(Loc diff) // shift stern by "diff" Rod shiftI(Loc diff) // inverse shift Rod scale(float factor) // scale the size of me by factor Rod scaleI(float factor) // inverse scaling Loc intersect2D(Rod to) // intersect position on the x-y plane float signedDist2D(Rod pt)// distance with sign of left/right side on the x-y plane float dist2D(Loc pt) // distance between "me" and "pt" on the x-y plane Loc normal(Loc pt) // the shortest rod connecting from "me" to "pt" Rod ortho(Loc pt) // the shortest rod connecting from "me" to "pt" Rod nearest(Rod to) // the shortest rod connecting from "me" to "to" float dist(Loc pt) // distance between "me" and "pt" boolean having(Loc pt) // is "me" having "pt" on myself ? float dist(Rod to) // least distance between "me" and line "to" boolean crossing(Rod to) // are "me" and "to" crossing each other ? float length() // length of me Loc stern() // location of the stern of me Loc bow() // location of the bow of me Loc fore() // foward direction of me, the unit vector Boolean equals(Rod to) String toString() }}}