Bug 366695 - Feature to change swap macros with identical input/output
Summary: Feature to change swap macros with identical input/output
Status: REPORTED
Alias: None
Product: kig
Classification: Applications
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Ubuntu Linux
: NOR wishlist
Target Milestone: ---
Assignee: David E. Narvaez
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-12 08:22 UTC by Alex
Modified: 2016-08-26 17:02 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex 2016-08-12 08:22:38 UTC
It would be a good feature, to be able to replace one macro by another one with the same input and output.

Example:
macro1(3 points, 1 point): construct a triangle from the points, construct the center of mass and return it
macro2(3 points, 1 point): construct a circle through the 3 points, construct the center of the circle and return it

now suppose i connected two such center of mass points with macro1, i would now like to swap the construction to the circumcenter (macro2), without changing anything else.
So the point should for example have a menu "change construction", which offers all possible 3 to 1 point macros.

Reproducible: Always
Comment 1 David E. Narvaez 2016-08-24 22:04:51 UTC
I am not sure what you mean by same input and same output: there are infinitely many macros that take 3 points as inputs and output 1 point.
Comment 2 Alex 2016-08-25 06:30:05 UTC
When macro1 and macro2 are given and there is an object constructed by macro1, i would like to click this object and select "replace macro1-object by macro2-object". This would internally then replace "CenterOfMass(Triangle(p1, p2, p3))" with "Center(Circle(p1, p2, p3))", when the constructed center of mass is right clicked and then "replace construction by macro2" is selected.
If you would assign IDs to the objects, p1, p2, p3 and result could still have the same IDs and all objects constructed using "result" as an input would still be constructable, because result is a point in both cases.
Finally this would then do something like

Given
Segment(p4, CenterOfMass(Triangle(p1, p2, p3)))

Replace: "CenterOfMass(Triangle(MACROINPUT))" by "Center(Circle(MACROINPUT))"

Resulting in 
Segment(p4, Center(Circle(p1, p2, p3)))

So the Segment constructed using the resulting-point is still intact.
Comment 3 David E. Narvaez 2016-08-26 12:23:10 UTC
Then I have a problem understanding the phrase "without changing anything else" in the original request: If I have a macro M1 that constructs the circumcenter of a triangle, and a macro M2 that constructs the incenter of a triangle, if I right-click on a point built uting M1 and change that to M2, everything that depends on that circumcenter is now changed to depend on the incenter.
Comment 4 Alex 2016-08-26 17:02:12 UTC
I do not mean "without changing the geometry" (as seen on the screen), but without changing the construction (as in some tree of operations or whatever the internal data structure does). So if i change the construction of a center of three points, i do not want to delete all segments which have the center as parent object, but keep them (and for example see how they change length and direction).

So when i have some complicated construction, which contains MORE_OPERATIONS(MACRO1(input))), i want to swap MACRO1 for MACRO2, leaving input as it is (maybe some complicated constructed object as well) and changing the Output geometry by applying MORE_OPERATIONS to the changed object.

Or like it would be in a saved file:

Document:

  <Object type="FixedPoint" id="8">
   <Parent id="7"/>
   <Parent id="1"/>
  </Object>
  <Object type="FixedPoint" id="9">
   <Parent id="3"/>
   <Parent id="4"/>
  </Object>
  <Object type="CircleBTP" id="10">
   <Parent id="9"/>
   <Parent id="8"/>
   <Parent id="6"/>
  </Object>
  <Property which="center" id="11">
   <Parent id="10"/>
  </Property>

Operation: Swap center(CircleBTP(input)) for polygon-center-of-mass(TriangleB3P(input))

Changed Document:
  <Object type="FixedPoint" id="7">
   <Parent id="6"/>
   <Parent id="5"/>
  </Object>
  <Data type="double" id="8">0.790236</Data>
  <Object type="FixedPoint" id="9">
   <Parent id="4"/>
   <Parent id="8"/>
  </Object>
  <Object type="TriangleB3P" id="10">
   <Parent id="7"/>
   <Parent id="3"/>
   <Parent id="9"/>
  </Object>
  <Property which="polygon-center-of-mass" id="11">
   <Parent id="10"/>
  </Property>

Everything having <Parent id="11"> change its geometry after this, everything having <Parent id="10"> before would need to be deleted as there is no circle anymore (and a triangle has other properties).