Back to project page HzGrapher.
The source code is released under:
Apache License
If you think the Android project HzGrapher listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.handstudio.android.hzgrapherlib.util; //w w w .ja v a2s . c o m public class EuclidLine { private EuclidPoint mPt1 = null; private EuclidPoint mPt2 = null; public EuclidLine ( EuclidPoint pt1 , EuclidPoint pt2 ) { mPt1 = pt1; mPt2 = pt2; } public float getLength () { return (float)Math.sqrt((mPt2.getX()-mPt1.getX())*(mPt2.getX()-mPt1.getX()) + (mPt2.getY()-mPt1.getY())*(mPt2.getY()-mPt1.getY())); } public float getEclination () { return 0.0f; } public EuclidPoint getPointOfLine ( boolean startFromPt1 , float distance ) { EuclidPoint ptRet = null; double dx = mPt2.getX() - mPt1.getX(); double dy = mPt2.getY() - mPt1.getY(); double theta = 0; if ( startFromPt1 == true ) { theta = Math.atan(dy/dx) + Converter.DegreeToRadian(180.0f); } else { theta = Math.atan ( dy / dx ); } double x = (double)mPt1.getX() + ((double)distance * Math.cos( theta )); double y = (double)mPt1.getY() + ((double)distance * Math.sin( theta )); ptRet = new EuclidPoint ( (float)x , (float)y ); return ptRet; } }