|
|
@ -32,13 +32,13 @@ public class Mesh { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.triangles = new ArrayList<>(); |
|
|
|
this.triangles = new ArrayList<>(); |
|
|
|
double radian = (double)rotation; |
|
|
|
int degrees = (int)Math.toDegrees(rotation); |
|
|
|
for(Triangle tri : CollisionManager.mesh_triangles.get(this.mesh_id)){ |
|
|
|
for(Triangle tri : CollisionManager.mesh_triangles.get(this.mesh_id)){ |
|
|
|
|
|
|
|
|
|
|
|
Triangle newTri = new Triangle(); |
|
|
|
Triangle newTri = new Triangle(); |
|
|
|
Vector3f rotatedPoint1 = Vector3f.rotateAroundPoint(new Vector3f(tri.point1.x,mesh_location.y,tri.point1.y),mesh_location,radian); |
|
|
|
Vector3f rotatedPoint1 = Vector3f.rotateAroundPoint(new Vector3f(tri.point1.x,mesh_location.y,tri.point1.y),mesh_location,degrees); |
|
|
|
Vector3f rotatedPoint2 = Vector3f.rotateAroundPoint(new Vector3f(tri.point2.x,mesh_location.y,tri.point2.y),mesh_location,radian); |
|
|
|
Vector3f rotatedPoint2 = Vector3f.rotateAroundPoint(new Vector3f(tri.point2.x,mesh_location.y,tri.point2.y),mesh_location,degrees); |
|
|
|
Vector3f rotatedPoint3 = Vector3f.rotateAroundPoint(new Vector3f(tri.point3.x,mesh_location.y,tri.point3.y),mesh_location,radian); |
|
|
|
Vector3f rotatedPoint3 = Vector3f.rotateAroundPoint(new Vector3f(tri.point3.x,mesh_location.y,tri.point3.y),mesh_location,degrees); |
|
|
|
|
|
|
|
|
|
|
|
newTri.point1 = new Point2D.Float(rotatedPoint1.x,rotatedPoint1.z); |
|
|
|
newTri.point1 = new Point2D.Float(rotatedPoint1.x,rotatedPoint1.z); |
|
|
|
newTri.point2 = new Point2D.Float(rotatedPoint2.x,rotatedPoint2.z); |
|
|
|
newTri.point2 = new Point2D.Float(rotatedPoint2.x,rotatedPoint2.z); |
|
|
@ -48,15 +48,17 @@ public class Mesh { |
|
|
|
newTri.sides.add(new Line2D.Float(newTri.point1,newTri.point2)); |
|
|
|
newTri.sides.add(new Line2D.Float(newTri.point1,newTri.point2)); |
|
|
|
newTri.sides.add(new Line2D.Float(newTri.point2,newTri.point3)); |
|
|
|
newTri.sides.add(new Line2D.Float(newTri.point2,newTri.point3)); |
|
|
|
newTri.sides.add(new Line2D.Float(newTri.point3,newTri.point1)); |
|
|
|
newTri.sides.add(new Line2D.Float(newTri.point3,newTri.point1)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.triangles.add(newTri); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void MakeBounds(float rotation){ |
|
|
|
public void MakeBounds(float rotation){ |
|
|
|
double radian = (double)rotation; |
|
|
|
int degrees = (int)Math.toDegrees(rotation); |
|
|
|
Vector3f rotatedEnd = Vector3f.rotateAroundPoint(new Vector3f(this.mesh_end_point.x,mesh_location.y,this.mesh_end_point.z),mesh_location,radian); |
|
|
|
Vector3f rotatedEnd = Vector3f.rotateAroundPoint(new Vector3f(this.mesh_end_point.x,mesh_location.y,this.mesh_end_point.z),mesh_location,degrees); |
|
|
|
Vector3f rotatedRef = Vector3f.rotateAroundPoint(new Vector3f(this.mesh_ref_point.x,mesh_location.y,this.mesh_ref_point.z),mesh_location,radian); |
|
|
|
Vector3f rotatedRef = Vector3f.rotateAroundPoint(new Vector3f(this.mesh_ref_point.x,mesh_location.y,this.mesh_ref_point.z),mesh_location,degrees); |
|
|
|
|
|
|
|
|
|
|
|
this.mesh_bounds = new Rectangle2D.Float(); |
|
|
|
this.mesh_bounds = new Rectangle2D.Float(); |
|
|
|
this.mesh_bounds.setRect(rotatedEnd.x,rotatedEnd.z,Math.abs(rotatedEnd.x) - Math.abs(rotatedRef.x),Math.abs(rotatedEnd.z) - Math.abs(rotatedRef.z)); |
|
|
|
this.mesh_bounds.setRect(rotatedEnd.x,rotatedEnd.z,Math.abs(Math.abs(rotatedRef.x) - rotatedEnd.x),Math.abs(rotatedEnd.z) - Math.abs(rotatedRef.z)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|