https://wiki.inkscape.org/wiki/api.php?action=feedcontributions&user=Skypainter&feedformat=atomInkscape Wiki - User contributions [en]2023-12-07T23:09:46ZUser contributionsMediaWiki 1.36.1https://wiki.inkscape.org/wiki/index.php?title=GSOC2007_3D_box_tool&diff=14549GSOC2007 3D box tool2007-05-07T18:02:18Z<p>Skypainter: </p>
<hr />
<div>= Project description and purpose of this Wiki =<br />
<br />
Information on the project can be found at the [http://www.rzuser.uni-heidelberg.de/~malbert accompanying website]. Currently provided are a description of the intended functionality and a collection of further ideas (beyond the scope of GSoC). Implementation-related details will follow soon.<br />
<br />
This Wiki on the other hand is intended to be a kind of 'bazaar of ideas'. People who are interested are warmly invited to share their thoughts. Feel free to add any ideas, ranging from the general functionality to implementation details. I started out with these two categories below, but please add further ones where appropriate.<br />
<br />
== Feature proposals ==<br />
<br />
Pretty self-explanatory.<br />
<br />
== Implementation details ==<br />
<br />
If you have ideas concerning the underlying maths, algorithms, class design, etc., this is the place to share it. Please bear in mind, however, that we are designing a tool for a 2D graphics application. This means that we are going to write a tool that <i>behaves</i> like it manipulates 3D objects, but most of the time the complete 3D information for the boxes and their corners (in particular, the precise value of the z-coordinate) won't be available. Instead, we will often need to fall back to information gained from the 2D canvas constellation of the corners and vanishing points. Thus, it is sometimes necessary to make approximations which lead to small deviations from the 'true' behaviour. Our aim is to preserve the right 'feeling' and to make these deviations as invisible as possible.<br />
<br />
== One opinion (Jose Hevia) ==<br />
<br />
Making a tool that behaves as 3d in 2d is, IMHO, impossible or severely limited, I have some experience trying exactly this, and believe that a model in some kind of 3d space is needed. Something as simple as a 2D layout that represents the plant is in itself 3d space.<br />
<br />
Making use of a known model let us use the math that is already there for perspective projections, there is no need for creating any new set of rules that are complex to manage when models evolve in complexity.<br />
<br />
E.g It's possible to use traditional technical drawings rules for drawing in the computer, using fugue points for every set op pararell lines and find intersection for every segment you draw.<br />
<br />
Well, you just need to create a new point, choose a fugue point(keybindings?) draw a segment.Fugue points need to be movile. Then you have two points. You draw new points using the same technical way, when two lines cross, you create two segments. Now just make it posible to select manually the segments that are ocluded and remove it.<br />
<br />
As there is no 3d model of it there is no way the computer knows how to do this automatically, and is only valid for a unique view. You have a model that only works with a couple of fugue points, that is difficult to maintain and very complex UI code slow to prove in something as huge as Inkscape codebase.<br />
<br />
== Alternative(Jose Hevia) ==<br />
<br />
Create a plant 3d model (extruded from 2d, from plant to top).<br />
<br />
A pair of fugue points are needed, one for every orthogonal directions. Now it's possible to extract the viewer direction.(*)<br />
A height of the horizon (view height),and extrusion height.(**)<br />
E.g:<br />
<br />
- Draw a path(conventional one) as the plant 2d model.<br />
- Use the path to draw the plant as a polygon:<br />
+Create 3d coordinates with height zero.<br />
+Apply perspective matrix, with the info from (*)(**)<br />
<br />
- If extrusion height > horizon draw top polygon:<br />
+Create 3d coordinates with height top.<br />
+Apply perspective matrix, with the info from (*)(**)<br />
<br />
- Create and draw faces:<br />
+Calculate path farther point to observer.<br />
+calculate path nearest point to observer.<br />
for farthest point to nearest point create left faces:<br />
+calculate two points from path with top height.<br />
+calculate two points from with zero height.<br />
+draw four points polygon.<br />
for farthest point to nearest point create right faces:<br />
+calculate two points from path with top height.<br />
+calculate two points from with zero height.<br />
+draw four points polygon.<br />
<br />
(+++)Caution:This code only works well if complex hull(path)==path, as happends with a rectangle. If not , it's necessary to order faces better.<br />
<br />
- If extrusion height < horizon draw top polygon:<br />
+Create 3d coordinates with height top.<br />
+Apply perspective matrix, with the info from (*)(**)<br />
<br />
Drawing with transparency, it's possible to create translucent boxes.It's difficult to express this in text form.My mail is in the list if someone is interested in discussing this.</div>Skypainter