| | |
| | | import com.anyun.exam.lib.util.ByteUtil; |
| | | import com.safeluck.aykj.utils.BytesUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.security.SecureRandom; |
| | | import java.util.Calendar; |
| | | import java.util.Random; |
| | |
| | | int unsignedTime= parseUnsignedInt(String.valueOf(longCurrTIme),10); |
| | | System.out.println("unsigned int time = "+unsignedTime); |
| | | |
| | | Point p1 = new Point(1.0,2.0); |
| | | Point p2 = new Point(3.0,4.0); |
| | | System.out.println(Calc3Point(p1,p2,5.0).toString()); |
| | | Point p1 = new Point(1.0,5.0); |
| | | Point p2 = new Point(3.0,5.0); |
| | | System.out.println(Calc3Point(p1,p2,10.0).toString()); |
| | | } |
| | | |
| | | public static Point Calc3Point(Point p1,Point p2,double L ){ |
| | |
| | | } |
| | | y3 = k * x3 + b; |
| | | |
| | | |
| | | p3.setX(x3); |
| | | p3.setY(y3); |
| | | |
| | | p3 = rotatePoint(p3, p2, 270); |
| | | |
| | | |
| | | return p3; |
| | | |
| | |
| | | private static Point rotatePoint(Point oldPoint,Point centre,double degree){ |
| | | |
| | | Point newPoint = new Point(0.0,0.0); |
| | | newPoint.setX((oldPoint.getX()-centre.getX())*cos(toRadians(degree)) - |
| | | (oldPoint.getY()-centre.getY())*sin(toRadians(degree)) + centre.getX()) ; |
| | | newPoint.setY( (oldPoint.getX()-centre.getX())*sin(toRadians(degree)) |
| | | + (oldPoint.getY()-centre.getY())*cos(toRadians(degree)) + centre.getY()); |
| | | newPoint.setX(getdouble((oldPoint.getX()-centre.getX())*cos(toRadians(degree)) - |
| | | (oldPoint.getY()-centre.getY())*sin(toRadians(degree)) + centre.getX(),6)) ; |
| | | newPoint.setY(getdouble( (oldPoint.getX()-centre.getX())*sin(toRadians(degree)) |
| | | + (oldPoint.getY()-centre.getY())*cos(toRadians(degree)) + centre.getY(),6)); |
| | | return newPoint; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 对double保留几位小数 |
| | | */ |
| | | public static Double getdouble(Double d,int reserve) { |
| | | |
| | | BigDecimal b= new BigDecimal(d); |
| | | return b.setScale(reserve, BigDecimal.ROUND_HALF_UP).doubleValue(); |
| | | } |
| | | } |