Trim trailing whitespace.

This commit is contained in:
whitequark 2016-10-25 13:10:06 +00:00
parent 15446e8f0a
commit 2ecc612801
16 changed files with 59 additions and 59 deletions

View File

@ -42,7 +42,7 @@ void Example3d(void)
sys.param[sys.params++] = Slvs_MakeParam(6, g, 20.0);
sys.entity[sys.entities++] = Slvs_MakePoint3d(102, g, 4, 5, 6);
// and a line segment connecting them.
sys.entity[sys.entities++] = Slvs_MakeLineSegment(200, g,
sys.entity[sys.entities++] = Slvs_MakeLineSegment(200, g,
SLVS_FREE_IN_3D, 101, 102);
// The distance between the points should be 30.0 units.
@ -117,7 +117,7 @@ void Example2d(void)
sys.entity[sys.entities++] = Slvs_MakePoint2d(302, g, 200, 13, 14);
// And we create a line segment with those endpoints.
sys.entity[sys.entities++] = Slvs_MakeLineSegment(400, g,
sys.entity[sys.entities++] = Slvs_MakeLineSegment(400, g,
200, 301, 302);
// Now three more points.

View File

@ -77,7 +77,7 @@ TYPES OF ENTITIES
SLVS_E_POINT_IN_3D
A point in 3d. Defined by three parameters:
param[0] the point's x coordinate
param[1] y
param[1] z
@ -122,7 +122,7 @@ SLVS_E_NORMAL_IN_3D
defines a 3x3 rotation matrix. So U, V, and N all have unit length,
and are orthogonal so that
U cross V = N
V cross N = U
N cross U = V
@ -181,7 +181,7 @@ SLVS_E_WORKPLANE
SLVS_E_LINE_SEGMENT
A line segment between two endpoints
point[0]
@ -211,7 +211,7 @@ SLVS_E_CIRCLE
normal
The circle is centered at
point[0]
The circle's radius is
@ -356,7 +356,7 @@ SLVS_C_SYMMETRIC_LINE**
SLVS_C_AT_MIDPOINT*
The point ptA lies at the midpoint of the line entityA.
SLVS_C_HORIZONTAL
SLVS_C_VERTICAL**

View File

@ -17,7 +17,7 @@ Imports System.Runtime.InteropServices
Module VbDemo
' Call our example functions, which set up some kind of sketch, solve
' it, and then print the result.
' it, and then print the result.
Sub Main()
Console.WriteLine("EXAMPLE IN 3d (by objects):")
Example3dWithObjects()
@ -42,13 +42,13 @@ Module VbDemo
' classes allow us to represent entities (e.g., lines and points)
' as .net objects. So we create an Slvs object, which will contain
' the entire sketch, with all the entities and constraints.
'
'
' We then create entity objects (for example, points and lines)
' associated with that sketch, indicating the initial positions of
' those entities and any hierarchical relationships among them (e.g.,
' defining a line entity in terms of endpoint entities). We also add
' constraints associated with those entities.
'
'
' Finally, we solve, and print the new positions of the entities. If the
' solution succeeded, then the entities will satisfy the constraints. If
' not, then the solver will suggest problematic constraints that, if
@ -598,7 +598,7 @@ Module VbDemo
Return Result
End Function
' After a call to Solve(), this returns the number of unconstrained
' After a call to Solve(), this returns the number of unconstrained
' degrees of freedom for the sketch.
Public Function GetDof() As Integer
Return Dof

View File

@ -349,7 +349,7 @@ void Constraint::MenuConstrain(int id) {
c.entityA = gs.entity[0];
c.ptA = gs.point[0];
c.ptB = gs.point[1];
} else if(gs.lineSegments == 1 &&
} else if(gs.lineSegments == 1 &&
((gs.workplanes == 1 && gs.n == 2) ||
(gs.n == 1)))
{
@ -490,7 +490,7 @@ void Constraint::MenuConstrain(int id) {
// normal vector; allow that, since the numerical
// constraint does
SWAP(Vector, ru, rv);
}
}
fu = fu.Dot(ru) > 0 ? ru : ru.ScaledBy(-1);
fv = fv.Dot(rv) > 0 ? rv : rv.ScaledBy(-1);
@ -548,7 +548,7 @@ void Constraint::MenuConstrain(int id) {
return;
}
Entity *ea = SK.GetEntity(c.entityA),
Entity *ea = SK.GetEntity(c.entityA),
*eb = SK.GetEntity(c.entityB);
if(ea->type == Entity::LINE_SEGMENT &&
eb->type == Entity::LINE_SEGMENT)

View File

@ -389,7 +389,7 @@ void ConstraintBase::GenerateReal(IdList<Equation,hEquation> *l) {
// the line segment, and choose the longer of these.
ExprVector eap = ea.Minus(ep);
ExprVector ebp = eb.Minus(ep);
ExprVector elp =
ExprVector elp =
(ebp.Magnitude()->Eval() > eap.Magnitude()->Eval()) ?
ebp : eap;
@ -413,7 +413,7 @@ void ConstraintBase::GenerateReal(IdList<Equation,hEquation> *l) {
EntityBase *normal = SK.GetEntity(circle->normal);
ExprVector u = normal->NormalExprsU(),
v = normal->NormalExprsV();
Expr *du = (center.Minus(pt)).Dot(u),
*dv = (center.Minus(pt)).Dot(v);
@ -443,7 +443,7 @@ void ConstraintBase::GenerateReal(IdList<Equation,hEquation> *l) {
EntityBase *ln = SK.GetEntity(entityA);
EntityBase *a = SK.GetEntity(ln->point[0]);
EntityBase *b = SK.GetEntity(ln->point[1]);
Expr *au, *av, *bu, *bv;
a->PointGetExprsInWorkplane(workplane, &au, &av);
b->PointGetExprsInWorkplane(workplane, &bu, &bv);
@ -601,7 +601,7 @@ void ConstraintBase::GenerateReal(IdList<Equation,hEquation> *l) {
ExprVector bu = b->NormalExprsU(),
bv = b->NormalExprsV(),
bn = b->NormalExprsN();
AddEq(l, VectorsParallel(0, an, bn), 0);
AddEq(l, VectorsParallel(1, an, bn), 1);
Expr *d1 = au.Dot(bv);
@ -662,7 +662,7 @@ void ConstraintBase::GenerateReal(IdList<Equation,hEquation> *l) {
EntityBase *line = SK.GetEntity(entityB);
ExprVector ac = SK.GetEntity(arc->point[0])->PointGetExprs();
ExprVector ap =
ExprVector ap =
SK.GetEntity(arc->point[other ? 2 : 1])->PointGetExprs();
ExprVector ld = line->VectorGetExprs();
@ -675,7 +675,7 @@ void ConstraintBase::GenerateReal(IdList<Equation,hEquation> *l) {
case CUBIC_LINE_TANGENT: {
EntityBase *cubic = SK.GetEntity(entityA);
EntityBase *line = SK.GetEntity(entityB);
ExprVector a;
if(other) {
a = cubic->CubicGetFinishTangentExprs();

View File

@ -33,7 +33,7 @@ public:
Quaternion ScaledBy(double s);
double Magnitude(void);
Quaternion WithMagnitude(double s);
// Call a rotation matrix [ u' v' n' ]'; this returns the first and
// second rows, where that matrix is generated by this quaternion
Vector RotationU(void);
@ -50,7 +50,7 @@ public:
class Vector {
public:
double x, y, z;
static Vector From(double x, double y, double z);
static Vector From(hParam x, hParam y, hParam z);
static Vector AtIntersectionOfPlanes(Vector n1, double d1,
@ -101,7 +101,7 @@ public:
static bool BoundingBoxIntersectsLine(Vector amax, Vector amin,
Vector p0, Vector p1, bool segment);
bool OutsideAndNotOn(Vector maxv, Vector minv);
Vector InPerspective(Vector u, Vector v, Vector n,
Vector InPerspective(Vector u, Vector v, Vector n,
Vector origin, double cameraTan);
Point2d Project2d(Vector u, Vector v);
Point2d ProjectXy(void);
@ -111,7 +111,7 @@ public:
class Vector4 {
public:
double w, x, y, z;
static Vector4 From(double w, double x, double y, double z);
static Vector4 From(double w, Vector v3);
static Vector4 Blend(Vector4 a, Vector4 b, double t);

View File

@ -280,7 +280,7 @@ void EntityBase::NormalForceTo(Quaternion q) {
break;
case NORMAL_N_ROT: {
Quaternion qp = q.Times(numNormal.Inverse());
SK.GetParam(param[0])->val = qp.w;
SK.GetParam(param[1])->val = qp.vx;
SK.GetParam(param[2])->val = qp.vy;
@ -756,8 +756,8 @@ void EntityBase::GenerateEquations(IdList<Equation,hEquation> *l) {
ConstraintBase *c = &(SK.constraint.elem[i]);
if(c->group.v != group.v) continue;
if(c->type != Constraint::POINTS_COINCIDENT) continue;
if((c->ptA.v == point[1].v && c->ptB.v == point[2].v) ||
if((c->ptA.v == point[1].v && c->ptB.v == point[2].v) ||
(c->ptA.v == point[2].v && c->ptB.v == point[1].v))
{
break;

View File

@ -346,7 +346,7 @@ Expr *Expr::PartialWrt(hParam p) {
db = b->PartialWrt(p);
return (a->Times(db))->Plus(b->Times(da));
case DIV:
case DIV:
da = a->PartialWrt(p);
db = b->PartialWrt(p);
return ((da->Times(b))->Minus(a->Times(db)))->Div(b->Square());
@ -673,7 +673,7 @@ void Expr::Parse(void) {
for(;;) {
Expr *n = Next();
if(!n) throw "end of expression unexpected";
if(n->op == CONSTANT) {
PushOperand(n);
Consume();

View File

@ -78,7 +78,7 @@ void Slvs_Solve(Slvs_System *ssys, Slvs_hGroup shg)
Slvs_Param *sp = &(ssys->param[i]);
Param p;
ZERO(&p);
p.h.v = sp->h;
p.val = sp->val;
SK.param.Add(&p);

View File

@ -272,7 +272,7 @@ public:
bool construction;
NameStr str;
NameStr font;
static hParam AddParam(ParamList *param, hParam hp);
void Generate(EntityList *entity, ParamList *param);
@ -659,7 +659,7 @@ class Style {
public:
int tag;
hStyle h;
// If an entity has no style, then it will be colored according to
// whether the group that it's in is active or not, whether it's
// construction or not, and so on.

View File

@ -11,9 +11,9 @@
#define __SLVS_H
#ifdef EXPORT_DLL
#define DLL __declspec( dllexport )
#define DLL __declspec( dllexport )
#else
#define DLL __declspec( dllimport )
#define DLL __declspec( dllimport )
#endif
#ifdef __cplusplus
@ -118,7 +118,7 @@ typedef struct {
Slvs_hEntity entityB;
Slvs_hEntity entityC;
Slvs_hEntity entityD;
int other;
int other2;
} Slvs_Constraint;
@ -158,10 +158,10 @@ typedef struct {
int calculateFaileds;
//// OUTPUT VARIABLES
//
//
// If the solver fails, then it can report which constraints are causing
// the problem. The caller should allocate the array failed[], and pass
// its size in faileds.
// its size in faileds.
//
// The solver will set faileds equal to the number of problematic
// constraints, and write their Slvs_hConstraints into failed[]. To

View File

@ -328,7 +328,7 @@ public:
bool onCurve;
bool lastInContour;
SWORD x;
SWORD y;
SWORD y;
} FontPoint;
typedef struct {
@ -380,7 +380,7 @@ public:
void LoadGlyph(int index);
bool LoadFontFromFile(bool nameOnly);
char *FontFileBaseName(void);
void Flush(void);
void Handle(int *dx, int x, int y, bool onCurve);
void PlotCharacter(int *dx, int c, double spacing);

View File

@ -197,7 +197,7 @@ public:
hSSurface surfA;
hSSurface surfB;
static SCurve FromTransformationOf(SCurve *a, Vector t, Quaternion q,
static SCurve FromTransformationOf(SCurve *a, Vector t, Quaternion q,
double scale);
SCurve MakeCopySplitAgainst(SShell *agnstA, SShell *agnstB,
SSurface *srfA, SSurface *srfB);
@ -275,13 +275,13 @@ public:
void EdgeNormalsWithinSurface(Point2d auv, Point2d buv,
Vector *pt, Vector *enin, Vector *enout,
Vector *surfn,
DWORD auxA,
DWORD auxA,
SShell *shell, SShell *sha, SShell *shb);
void FindChainAvoiding(SEdgeList *src, SEdgeList *dest, SPointList *avoid);
SSurface MakeCopyTrimAgainst(SShell *parent, SShell *a, SShell *b,
SShell *into, int type);
void TrimFromEdgeList(SEdgeList *el, bool asUv);
void IntersectAgainst(SSurface *b, SShell *agnstA, SShell *agnstB,
void IntersectAgainst(SSurface *b, SShell *agnstA, SShell *agnstB,
SShell *into);
void AddExactIntersectionCurve(SBezier *sb, SSurface *srfB,
SShell *agnstA, SShell *agnstB, SShell *into);
@ -388,7 +388,7 @@ public:
int ClassifyRegion(Vector edge_n, Vector inter_surf_n, Vector edge_surf_n);
bool ClassifyEdge(int *indir, int *outdir,
Vector ea, Vector eb,
Vector p,
Vector p,
Vector edge_n_in, Vector edge_n_out, Vector surf_n);
void MakeFromCopyOf(SShell *a);

View File

@ -289,7 +289,7 @@ bool System::NewtonSolve(int tag) {
if(!SolveLeastSquares()) break;
// Take the Newton step;
// Take the Newton step;
// J(x_n) (x_{n+1} - x_n) = 0 - F(x_n)
for(i = 0; i < mat.n; i++) {
Param *p = param.FindById(mat.param[i]);
@ -393,7 +393,7 @@ void System::FindWhichToRemoveToFixJacobian(Group *g, List<hConstraint> *bad) {
}
}
int System::Solve(Group *g, int *dof, List<hConstraint> *bad,
int System::Solve(Group *g, int *dof, List<hConstraint> *bad,
bool andFindBad, bool andFindFree)
{
WriteEquationsExceptFor(Constraint::NO_CONSTRAINT, g);
@ -412,7 +412,7 @@ int System::Solve(Group *g, int *dof, List<hConstraint> *bad,
// All params and equations are assigned to group zero.
param.ClearTags();
eq.ClearTags();
SolveBySubstitution();
// Before solving the big system, see if we can find any equations that
@ -522,7 +522,7 @@ didnt_converge:
}
}
}
return System::DIDNT_CONVERGE;
}

View File

@ -93,12 +93,12 @@ public:
BYTE *HsvPattern1d(double h, double s);
void ColorPickerDone(void);
bool DrawOrHitTestColorPicker(int how, bool leftDown, double x, double y);
void Init(void);
void MakeColorTable(const Color *in, float *out);
void Printf(bool half, char *fmt, ...);
void ClearScreen(void);
void Show(void);
// State for the screen that we are showing in the text window.
@ -506,7 +506,7 @@ public:
hEntity circle;
hEntity normal;
hConstraint constraint;
char *description;
} pending;
void ClearPending(void);
@ -525,7 +525,7 @@ public:
Vector p0, p1;
Vector u, v;
double r, theta0, theta1, dtheta;
void MakeFromEntity(hEntity he, bool reverse);
Vector PointAt(double t);
Vector TangentAt(double t);
@ -544,7 +544,7 @@ public:
void ReplacePointInConstraints(hEntity oldpt, hEntity newpt);
void FixConstraintsForRequestBeingDeleted(hRequest hr);
void FixConstraintsForPointBeingDeleted(hEntity hpt);
// The current selection.
class Selection {
public:

View File

@ -99,7 +99,7 @@ bool StringEndsIn(char *str, char *ending)
int i, ls = strlen(str), le = strlen(ending);
if(ls < le) return false;
for(i = 0; i < le; i++) {
if(tolower(ending[le-i-1]) != tolower(str[ls-i-1])) {
return false;
@ -601,7 +601,7 @@ Vector Vector::ScaleOutOfCsys(Vector u, Vector v, Vector n) {
return r;
}
Vector Vector::InPerspective(Vector u, Vector v, Vector n,
Vector Vector::InPerspective(Vector u, Vector v, Vector n,
Vector origin, double cameraTan)
{
Vector r = this->Minus(origin);
@ -742,7 +742,7 @@ Vector Vector::ClosestOrtho(void) {
}
}
Vector Vector::ClampWithin(double minv, double maxv) {
Vector Vector::ClampWithin(double minv, double maxv) {
Vector ret = *this;
if(ret.x < minv) ret.x = minv;
@ -820,11 +820,11 @@ bool Vector::BoundingBoxIntersectsLine(Vector amax, Vector amin,
Vector Vector::AtIntersectionOfPlanes(Vector n1, double d1,
Vector n2, double d2)
{
double det = (n1.Dot(n1))*(n2.Dot(n2)) -
double det = (n1.Dot(n1))*(n2.Dot(n2)) -
(n1.Dot(n2))*(n1.Dot(n2));
double c1 = (d1*n2.Dot(n2) - d2*n1.Dot(n2))/det;
double c2 = (d2*n1.Dot(n1) - d1*n1.Dot(n2))/det;
return (n1.ScaledBy(c1)).Plus(n2.ScaledBy(c2));
}
@ -846,7 +846,7 @@ void Vector::ClosestPointBetweenLines(Vector a0, Vector da,
// So dot this equation against dna and dnb to get two equations
// to solve for da and db
*tb = ((a0.Minus(b0)).Dot(dna))/(db.Dot(dna));
*ta = -((a0.Minus(b0)).Dot(dnb))/(da.Dot(dnb));
*ta = -((a0.Minus(b0)).Dot(dnb))/(da.Dot(dnb));
}
Vector Vector::AtIntersectionOfLines(Vector a0, Vector a1,
@ -1039,7 +1039,7 @@ double Point2d::Dot(Point2d p) {
double Point2d::DistanceToLine(Point2d p0, Point2d dp, bool segment) {
double m = dp.x*dp.x + dp.y*dp.y;
if(m < LENGTH_EPS*LENGTH_EPS) return VERY_POSITIVE;
// Let our line be p = p0 + t*dp, for a scalar t from 0 to 1
double t = (dp.x*(x - p0.x) + dp.y*(y - p0.y))/m;