CurvedGeometryFactory factory;
if (arcParameters != null && arcParameters.getLinearizationTolerance() != null) {
double tolerance = Double.MAX_VALUE;
if (cs != null) {
CircularArc arc = CurvedGeometries.getArc(cs, 0);
Circle c = new Circle(arc.getCenter(), arc.getRadius());
tolerance = arcParameters.getLinearizationTolerance().getTolerance(c);
}
factory = new CurvedGeometryFactory(gFactory, tolerance);
} else if (gFactory instanceof CurvedGeometryFactory) {
factory = (CurvedGeometryFactory) gFactory;