treewide: dart format + analyze + some other fixes
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
|
||||
import 'dart:math' as math;
|
||||
|
||||
|
||||
import '../common/point.dart';
|
||||
|
||||
// class Point {
|
||||
@@ -31,7 +29,8 @@ double time(Point pt1, Point ct1, Point ct2, Point pt2, double x) {
|
||||
final num c = 3 * ct2.x - 3 * pt2.x;
|
||||
final num d = pt2.x - x;
|
||||
|
||||
if (a.abs() < 0.000000001) { // quadratic
|
||||
if (a.abs() < 0.000000001) {
|
||||
// quadratic
|
||||
if (b.abs() < 0.000000001) return -d / c; // linear
|
||||
|
||||
final qb = c / b;
|
||||
@@ -45,7 +44,8 @@ double time(Point pt1, Point ct1, Point ct2, Point pt2, double x) {
|
||||
final addcoef = -b / (3 * a);
|
||||
|
||||
final lmbd = sq(q) / 4 + cb(p) / 27;
|
||||
if (lmbd >= 0) { // real
|
||||
if (lmbd >= 0) {
|
||||
// real
|
||||
final sqlambda = sqrt(lmbd);
|
||||
final tmp = thrt(-q / 2 + (q < 0 ? sqlambda : -sqlambda));
|
||||
return tmp - p / (3 * tmp) + addcoef;
|
||||
@@ -84,4 +84,4 @@ double value(Point pt1, Point ct1, Point ct2, Point pt2, double x) {
|
||||
// for i in range(0,part+1,1):
|
||||
// x = float(i) / part
|
||||
// y = value(pt1, ct1, ct2, pt2, x)
|
||||
// f.write("%f %f\n" % (x,y))
|
||||
// f.write("%f %f\n" % (x,y))
|
||||
|
||||
Reference in New Issue
Block a user