Commit Graph

  • e67ea9ca0f Add perspective, by a user-specified factor. So I have to apply that perspective in the gl matrices, and also everywhere that I check mouse pointer positions against the model, and for the zoom to fit. Jonathan Westhues 2008-06-17 11:12:25 -0800
  • b5c87291ea Fix failure to solve when auto-constraining new arc, and make all paths absolute immediately. Jonathan Westhues 2008-06-16 00:35:05 -0800
  • 3b4aa2c2b2 Little fixes for units display, and change file format to binary (even though it's still a text file), to avoid CRLF issue. Jonathan Westhues 2008-06-14 15:31:36 -0800
  • 4c6d350cee Add two more exotic constraints: equal point-line distances, and point-line distance equal to line segment length. These are available in both normal and projected versions, with fancy display for all of these. Jonathan Westhues 2008-06-14 03:16:14 -0800
  • d391c43bff Now display dimensions (and stuff in the text window) in the user-selected units, and enter them the same way. Jonathan Westhues 2008-06-14 01:51:25 -0800
  • 28e3f0abab Don't keep a dimension or group's user-entered numerical value as an Expr *, since that complicates multiple units and also memory management. Now it's just a double. Jonathan Westhues 2008-06-14 00:43:38 -0800
  • 1674443ab2 Fix stupidity in the rotate ops; first of all it was saving the axis of rotation numerically, so that the associative thing breaks, and then it also wasn't saving the point on the axis in the file, so that snapped back to (0, 0, 0) on reload. Now it goes off the hEntity for a point on the axis and a vector in its direction. Jonathan Westhues 2008-06-12 21:32:55 -0800
  • b284baffce Treatment of numerical faces was screwy, exporting stuff in numXXX. So fix that, and now I can simplify what's exported for an entity. Jonathan Westhues 2008-06-12 20:41:27 -0800
  • 9bba9425be Add a special constraint type for comments; no equations, just user-visible text. And make points hoverable/selectable even when GW.showPoints is false, and zoom to fit before regenerating on file open, because then we're at the right zoom level (and will use the right pwl tolerance). Jonathan Westhues 2008-06-12 00:58:58 -0800
  • 650e9db150 Add more measurement information about the selection. And remove menu items for some features that I suppose I won't add, and fix some bugs. Jonathan Westhues 2008-06-11 23:31:41 -0800
  • 8969687904 Bits and pieces; option to not include original in step translates and rotates, auto-constrain translates in active workplane, speed up remap list search with a hash table, other stuff. Jonathan Westhues 2008-06-11 20:36:33 -0800
  • 83f741bd06 Draw with a red background when we're having solve problems. Jonathan Westhues 2008-06-10 20:54:56 -0800
  • f8636eaddf The lights are directional, so call those triples directions, not positions. Jonathan Westhues 2008-06-10 20:30:18 -0800
  • d471872830 Add reference dimensions, add user-programmable lighting, and add a configuration screen where all this can be specified. Jonathan Westhues 2008-06-10 20:22:52 -0800
  • f2645029b8 Add a second light, and some little fixes, and remove dead code. Jonathan Westhues 2008-06-09 01:03:21 -0800
  • 34d2d531e6 Oops, couldn't specify the color of a lathe group. Jonathan Westhues 2008-06-06 03:36:16 -0800
  • 8498a99588 Add preliminary lathe (solid of revolution) support. I'm generating just the mesh, no derived entities (but I suppose that I could turn all points into circles). Jonathan Westhues 2008-06-06 03:35:28 -0800
  • dc15d667e3 Show more description of faces when they are selected. Jonathan Westhues 2008-06-06 01:14:25 -0800
  • ccbda13a03 Add point-face distance constraints. Jonathan Westhues 2008-06-06 00:46:55 -0800
  • 8a0809e6a0 Split some large files. Jonathan Westhues 2008-06-06 00:14:37 -0800
  • ab44c24cfc Major speedups, mostly by playing nicer with OpenGL; batch things up more. Also change from stupid linear search lists to sorted binary search lists, remove a stupid bug where I double-generated entities, and don't do the triple drawing of entities (since offsets on the Z buffer were doing the same job already). Jonathan Westhues 2008-06-05 23:50:08 -0800
  • 48612bde3d Add undo/redo. This saves the param guesses, constraints, groups, and requests to a separate list. It's messy, because I have to make a deep copy (e.g. of the remap list for the groups, or Expr * stuff) of some things. Others (e.g. the polygon or mesh) will be regenerated, so they should be discarded, but they must not get double-freed. Jonathan Westhues 2008-06-04 02:22:30 -0800
  • 71391e6a55 Add an interference check for assembled parts. That's easy once the BSP stuff works. The failures are reported with red stripes and no depth buffering, and in a message in the text window. Jonathan Westhues 2008-06-03 22:39:32 -0800
  • 64c7a4e61b Fix bugs: problem drag-rotating normals with the mouse, a failure to save our registry stuff (because we were calling exit() instead of doing a PostQuitMessage()), and a misclassification of triangles coplanar with the test surface, when the test surface contained zero-area triangles. Jonathan Westhues 2008-06-03 10:48:47 -0800
  • ea6db67c7d Improve convergence of constraints involving parallel vectors, by using the initial numerical guess of whichever vector is already known to choose our projection planes. Jonathan Westhues 2008-06-03 10:28:41 -0800
  • 7d4a4fbb76 We now have selective solve; a group (and all the groups afterward) becomes dirty when the user makes a change, and only the dirty groups get solved. That's a huge effective speedup. Jonathan Westhues 2008-06-02 03:43:27 -0800
  • 5bbb27fd8e Now requests don't have names anymore, because that didn't seem useful. The description string is just the type of request. Jonathan Westhues 2008-06-02 01:41:39 -0800
  • 236ee16da6 Consolidate the code that determines whether an entity is visible in one place. And remove the ability to disable the solver, since that's unlikely to be anything but confusing (and in any case, was badly implemented). This is in preparation for selective solving, of only the dirty groups. Jonathan Westhues 2008-06-02 01:31:26 -0800
  • a084b32064 Stipple the selected/hovered faces, instead of drawing them in solid red or yellow. And add user interface to `hide' the faces (i.e., to make them unselectable), defaulting to hidden in everything except extrudes or imports. Jonathan Westhues 2008-06-01 21:38:12 -0800
  • 1f70494ce9 Use the vectorized XxxVector::From() functions in a few more places, to eliminate repetition. Jonathan Westhues 2008-06-01 19:37:58 -0800
  • 6748160026 Add selectable faces, by associating an hEntity with the triangle's metadata. And add point-on-face constraints to go with that. Still needs some cleanup for the user interface. Jonathan Westhues 2008-06-01 19:31:37 -0800
  • 57db9bea34 Use a higher-res timer for GetMilliseconds(), and tweak some stuff. Jonathan Westhues 2008-06-01 01:46:02 -0800
  • 857395966a More use of ::From functions to simplify code. Jonathan Westhues 2008-06-01 00:57:16 -0800
  • 04af0944bc Standardize naming of FromXxx (and XxxFrom) static methods to create a `new' stack-allocated instance of an object; just From, possibly different versions with different arg types. Jonathan Westhues 2008-06-01 00:45:11 -0800
  • 709b5ad80e Add an axis-angle transformation (rotation about an arbitrary point), and use that to implement step and repeat rotating. Jonathan Westhues 2008-06-01 00:29:59 -0800
  • 1d1bec83b1 Little tweaks: wider lines drawn, fix editing dimensions. Jonathan Westhues 2008-05-31 20:31:28 -0800
  • 2cb4800fbf Start to describe the selected entities in the text window. Also more starting work on the selectable faces, and fiddling in an attempt to remove dependencies when stuff gets deleted. Jonathan Westhues 2008-05-31 16:26:41 -0800
  • f803806029 Don't initialize the SEdges with ... = { ... }; use a special function for that. Jonathan Westhues 2008-05-30 00:01:19 -0800
  • eb8a43d22b Fix stupidity in the triangle simplification; I didn't handle the case where you bolt a triangle onto a convex poly, and both remaining edges of the tri are coincident with the neighbours from the poly. That was a big source of zero-area triangles. Jonathan Westhues 2008-05-29 23:32:30 -0800
  • 69eb2273ac Add color. Now each triangle has metadata, which are preserved in csg ops; so the union of a red part and a blue part has both red and blue faces. And some user interface to pick the color in the text window. Jonathan Westhues 2008-05-29 22:09:41 -0800
  • 4bd44bf18a Initial work on the assembly (`import') feature. I can import a part, including all of its entities and the triangle mesh. These are transformed by a rotation and translation, and appear in the sketch; the transformation may be set with constraints. Jonathan Westhues 2008-05-29 02:10:12 -0800
  • d5a8c431da Oops, Boolean 0 - B was equal to B with the normals flipped, not zero. Jonathan Westhues 2008-05-28 02:37:54 -0800
  • 3c9084b240 Remove stupid "show any datum" link, and replace with a link to show/hide the mesh (drawn as wireframe triangles). Jonathan Westhues 2008-05-28 02:34:55 -0800
  • 502211495b Add the file open/save user interface. This includes a list of recently opened files, that is saved in the registry and displayed in a separate popup menu. Jonathan Westhues 2008-05-28 02:10:31 -0800
  • 93c797329e More reasonable default window locations. Jonathan Westhues 2008-05-27 01:59:19 -0800
  • 010a65894d Now I can rename groups, using that same edit control in the text window. Jonathan Westhues 2008-05-27 01:52:36 -0800
  • 4375c01c51 Add step and repeat translate, with multiple copies; that all works nicely. And to do that, I've added the user interface to show an edit control in the text window. Jonathan Westhues 2008-05-26 22:36:59 -0800
  • ecee90965e Change the workplanes a bit. Now the active workplane is per group, so e.g. a new extrude starts in free space, which is likely what you want. And default to an in-workplane group, and tweak the display of workplanes. Jonathan Westhues 2008-05-26 18:22:20 -0800
  • dd70cb55a2 Make it work when I insert against a NULL bsp3. Jonathan Westhues 2008-05-26 16:34:26 -0800
  • b484c26493 Many user interface additions. Now I report when the solver fails, and in the case of a singular Jacobian, report which constraints can be removed to fix it. Also a mechanism to hover and select entities and constraints from the text window. Jonathan Westhues 2008-05-26 01:56:50 -0800
  • 727ac126fb Some ugly hacks; discard zero-area triangles, randomize the triangle list before adding to the BSP, and check if a point in plane lies in multiple triangles and choose the one with the biggest normal magnitude (i.e., area) when testing normal direction. Jonathan Westhues 2008-05-25 22:23:05 -0800
  • d750344653 Even if one vertex is collinear, the other one could be reflex; triangle merging code was screwing up. Jonathan Westhues 2008-05-25 20:27:34 -0800
  • c58dbf1676 When a triangle gets split when it's added, retriangulate in an effort to reduce the number of pieces. Jonathan Westhues 2008-05-25 19:39:45 -0800
  • 05b50e0af8 Various tweaks, including a numerical improvement, to make the epsilon in the csg stuff meaningfully apply everywhere to the length. Jonathan Westhues 2008-05-25 06:36:03 -0800
  • 248f74547e Add user interface to specify union/difference for extrudes, and implement that. Also make solver work only between the first and last visible group; earlier can just work from previous solve result, and later don't matter. Jonathan Westhues 2008-05-25 05:11:44 -0800
  • 1909d4c520 The rule for when to keep coplanar surfaces was very wrong; fix it. Jonathan Westhues 2008-05-24 16:37:11 -0800
  • 0ad8644df4 As we break things against the BSP, keep an arbitrary convex polygon, not just triangles. This helps to avoid needless splitting. Also test if an entire triangle got inserted in multiple pieces; if yes, back things out, and just insert the triangle. Jonathan Westhues 2008-05-24 15:10:00 -0800
  • 097d0ddfa9 Add a workaround for OpenGL, which likes to tesselate with zero-area triangles, apparently. And make the number of line segments used to approximate a triangle depend on its scale on screen. Jonathan Westhues 2008-05-24 05:23:25 -0800
  • 70ccbebc8f Add extra split planes (not coplanar with any triangle) to the BSP while building it. That may improve performance, by building a more balanced tree and actually reducing splitting. Not dramatic improvements, though; half the triangles for some parts, but no change or slightly worse for others. Jonathan Westhues 2008-05-24 04:23:25 -0800
  • 4d7ffc85f9 Make coplanar faces work properly, by implementing a 2d BSP on each set of coplanar faces. The polygon count still gets stupid fast; I'm thinking I can fix that by adding some extra test planes at the top of the 3d BSP, to quickly cull out stuff that doesn't intersect us. Jonathan Westhues 2008-05-24 02:34:06 -0800
  • de46118324 Add code to extrude a triangle mesh, and to perform Boolean ops on a triangle mesh in a BSP. That works, although it splits too often, the initial triangulations are not good quality, and coplanar faces are not yet handled. I'll do the coplanar thing tomorrow. Jonathan Westhues 2008-05-23 02:05:07 -0800
  • c079497762 And add mesh.cpp, which I had forgotten. Jonathan Westhues 2008-05-22 02:28:50 -0800
  • 7c4d305895 Add polygon triangulation, by cheating. I'm using the gl tesselator for that, and storing the triangles instead of rendering them immediately. Not sure if that's smart; in theory could change from implementation to implementation, but the results look much better than I would get myself. Jonathan Westhues 2008-05-22 02:28:28 -0800
  • e80328279e Rip out the boundary rep csg stuff. I'll redo that with a triangle mesh approach. Jonathan Westhues 2008-05-20 19:58:14 -0800
  • c4e1270e25 Add constructive solid geometry ops. These work to some extent, but not very well; I'm doing a b-rep, where the boundaries are complex polygons, and there's too many special cases. I should probably replace this with a triangle mesh solution. Jonathan Westhues 2008-05-19 01:23:49 -0800
  • 4b6f8eabb6 Clear selection etc. after deleting items due to a failed dependency; no telling what might be out of date after that. Jonathan Westhues 2008-05-17 18:18:47 -0800
  • 30ad41f4a2 Fix a crash; it was possible to attempt to draw in a workplane that's in a group that solves after the current group. This means that the constraint/request gets deleted instantly, and stuff like auto-constraints on the just-created entities blow up. I now check that the active workplane comes from the active group or one solved before it. Jonathan Westhues 2008-05-17 15:48:58 -0800
  • 48132082ba Minor tweaks; and always go into the debugger after an oops(). Jonathan Westhues 2008-05-17 15:21:02 -0800
  • b480613763 Add angle constraints. I'm doing these differently from SketchFlat, as a constraint on the direction cosine, rather than driving the dot product against a rotated vector to zero. The drawing is the ugly part; to do that for skew lines, I gave up. Jonathan Westhues 2008-05-17 03:15:14 -0800
  • 749e2a0149 Add double-sided extrudes, and user interface for that. Also put the coordinate system (x, y, z normal vectors) in the bottom left corner of the screen at all times, and hide group-created workplanes except when that group is active, and activate that workplane when the group is activated. Jonathan Westhues 2008-05-17 00:02:39 -0800
  • 3cdbbb83b1 If a deletion makes it impossible to define other elements of the sketch (e.g., a line whose length is constrained gets deleted, but the constraint is left behind; or the point that's the origin for a drawing group in plane gets deleted), then deleted the dependencies too. Jonathan Westhues 2008-05-16 22:04:55 -0800
  • 2ec23ffa3e Fix point-on-circle constraints to work with arcs too, and lock extrudes normal to workplane if a workplane is active when the extrusion is created. Jonathan Westhues 2008-05-15 22:34:06 -0800
  • 65ea276fa4 I turned on hardware acceleration for my graphics card, and everything broke; apparently that driver didn't like me continually destroying and recreating the HPGL context, and it also didn't like me drawing zero-area polygons for my edges (which seemed like a good idea, because it let me use glPolygonOffset instead of doing that by hand). So it now all seems to work again, and faster. Jonathan Westhues 2008-05-15 20:54:47 -0800
  • e8fbf81de5 Do spherical linear interpolation when we animate onto a workplane. Jonathan Westhues 2008-05-14 06:23:58 -0800
  • 21c0c87d8e Replace fudging of coordinates with glPolygonOffset(). Jonathan Westhues 2008-05-13 03:27:32 -0800
  • aa5c621d82 Add symmetry constraints without an explicit symmetry plane; these use the horizontal or vertical axes of the active workplane. The equations that we write from these are very fast (of the form u + v = 0, or u - v = 0). Jonathan Westhues 2008-05-13 02:38:21 -0800
  • 6031c99bec Scale columns of the Jacobian before least squares solving; this lets me reweight the parameters, e.g. to encourage the solver to make changes to the point being dragged. Jonathan Westhues 2008-05-12 18:35:31 -0800
  • 364938f332 Add an arc entity. That's not allowed to exist in free space (since we need something to force the points into plane, and the workplane supplies that), but otherwise straightforward. And add diameter and equal radius constraints for the arc. Jonathan Westhues 2008-05-12 02:01:44 -0800
  • f4d2651031 Get rid of assumptions, which always did cause trouble. Instead, solve the Newton's method iterations in a least squares sense. This is much less likely to result in numerical disaster; a parameter will never make a very large change, unless that really is the only way to satisfy the constraints. Jonathan Westhues 2008-05-11 23:29:50 -0800
  • e2263c69c8 Find a memory corruption! I was getting a pointer into the entity list, and then adding a new entity to that list, and then looking at that pointer again. Not okay; the add operation might have forced a realloc. I have to watch for that. Jonathan Westhues 2008-05-11 02:40:37 -0800
  • 6042fb3e0f Add transformed points and normals with a rotation (as well as a translation; or equivalently, rotation about an arbitrary axis). Those will be important for step and repeats, and for imported parts. Jonathan Westhues 2008-05-10 22:09:46 -0800
  • 4eed7693be Little changes, more pwls in a circle, and make "same orientation" constraints work mod 180 degrees, so that it snaps to however the workplane was drawn (more vertical vs. more horizontal). Jonathan Westhues 2008-05-10 18:57:47 -0800
  • 10240cc1df Add parallel and same orientation constraints, that work on line segments and normals. Jonathan Westhues 2008-05-08 21:33:23 -0800
  • 018e8a0444 Draw an additional projection line, when showing a point-line projected distance constraint. Jonathan Westhues 2008-05-08 00:12:23 -0800
  • e11da119f0 Add point-line distance, point-plane distance, and point-on-circle constraints. And generate the constraint equations for entities (e.g., that our unit quaternions have magnitude one). Numerical troubles there, but it sort of works. Also some stuff to draw projection lines with projected constraints, and to auto-insert more constraints as you draw. Jonathan Westhues 2008-05-07 23:30:30 -0800
  • 328a946cc4 Add a diameter constraint, and add a `distance' entity that I can remap when I copy circle entities, in order to make the radius numerical somehow (analogy with the POINT_ and NORMAL_XFRMD) thing. Jonathan Westhues 2008-05-07 00:19:37 -0800
  • c05659753a Add the substitution solver. That speeds things up a bit, and improves the quality of assumptions. Jonathan Westhues 2008-05-06 23:10:20 -0800
  • 6b264a6ba6 Add a convenience command to draw a rectangle (as four line segments), add the toggle construction command, and color the lines differently depending on what group you're in. Jonathan Westhues 2008-05-06 20:17:29 -0800
  • c767d55c71 Now we can add new workplanes. So fix all the mistakes that I hadn't previously noticed, because I didn't use to have workplanes with non-zero offsets. And clean up the interface to normals a bit. Jonathan Westhues 2008-05-05 03:17:00 -0800
  • d048946adc Fix some stupid bugs introduced with the new representation of workplanes. And fix up our polygon normals, so that everything gets shaded correctly (and so that later we can generate our STL files with correct normals). Jonathan Westhues 2008-05-05 01:47:23 -0800
  • 853c6cb59c A big change, to add a concept of normals. These are "oriented vectors", represented by unit quaternions. This permits me to add circles, where the normal defines the plane of the circle. Jonathan Westhues 2008-05-04 22:18:01 -0800
  • 01885736e6 Fix my rotation-matrix-to-quaternion code: it broke when the diagonal elements of the matrix summed to -1. Now it's ugly, but I think that it's correct. And add a command to flip the view to the other side, which is what started my problems. And tweak display of H and V and M for constraints: put them in the constraint plane, so that they're stationary as you rotate around. Jonathan Westhues 2008-05-02 19:33:35 -0800
  • 30636a6f29 Make the extrude command do a bit more; now I generate all the faces of the polyhedron. And shade the faces when I draw them, and fix up our projection matrix so that the depth testing works properly. Jonathan Westhues 2008-05-02 02:54:22 -0800
  • 658b7df50f Make at-midpoint constraint also work to constrain midpoint of a line segment on a plane. And simplify that code a bit, and improve display. Jonathan Westhues 2008-04-30 22:53:50 -0800
  • b7e8b99f37 Don't blow up when the pending point doesn't seem to exist; that happens if we're solving an earlier group than the one that contains the pending point. Jonathan Westhues 2008-04-30 22:38:00 -0800
  • f1c5d07e39 Sort the parameters by sensitivity before solving, and always sort the point that's being dragged first, to guarantee that that one gets the max possible degrees of freedom. The sort code (sort a list of integers, then apply the permutations by swaps) was more painful than it should have been. Jonathan Westhues 2008-04-30 22:25:38 -0800
  • 498ffd07ea Add symmetric and at midpoint constraints. The symmetry constraint turned out straightforward, in great part because the planes are workplanes (6 DOF, represented by a unit quaternion and a point), and therefore make it easy to get a vector in the plane, as well as a normal. Jonathan Westhues 2008-04-30 00:14:32 -0800
  • 60925e4040 A ~10x speedup in the solver. Simplify equations before evaluating or taking partials (constant folding). Also keep a little hash table to mark with params are used in each equation, in order to quickly discard trivial partial derivatives. This is solving a 64x64 system in <20 ms. I suspect this is now much faster than Sketchflat. Jonathan Westhues 2008-04-29 20:52:34 -0800
  • 70bf14530d Add point on line constraints, in 2d and 3d. The 3d equations do not have much motivation behind them, but they seem to work. And make sure that we don't solve multiple times without repainting in between, and tweak the text window a bit more. Jonathan Westhues 2008-04-28 01:40:02 -0800
  • 598d456d8d Tear apart the text window, mostly to beautify things. The foreground and background colours are now specified separately, and it's possible to insert half-line spaces. So now I have a window that lets me show/hide groups, and select the active one. Jonathan Westhues 2008-04-27 23:18:39 -0800