Recent

Author Topic: Fit tool  (Read 2784 times)

wp

  • Hero Member
  • *****
  • Posts: 13431
Fit tool
« on: October 02, 2012, 03:56:17 pm »
A discussion with a user of the German Lazarus forum gave me the idea that the TDatapointDistanceTool could be generalized for other measurement tasks.

You drag a horizontal line across the region of interest, and the new tool fits a polynomial to the data in that range. A polynomial of degree 0 would yield the mean value in the selected range, a polyomial of degree 1 allows to determine the slope (very important in technical and physical applications), and a polynomial of degree 2 around a peak allows to identify the coordinates of the peak.

In the attachment I am posting a little application in which the events of the TDatapointDistanceTool are used to perform the calculations and to display the results.

Maybe this is of interest for somebody. Ideally, the code could be put into a separate "TFitTool" but some changes in the underlying infrastructure are needed to get rid of some unnecessary properties of the distance tool.

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: Fit tool
« Reply #1 on: October 02, 2012, 04:46:50 pm »
Yes, a nice application. I have added it as a "fit" page of the "distance" demo in r38951.
I've made few modifications to improve the visuals and shorten the code.

Quote
the code could be put into a separate "TFitTool"
I am not sure if such a tool would be general enough.
It seems to me that the measure tool actually fits quite nicely -- the amount of user-written code is reasonable, and I see no traps or subtle problems.

So I'll leave it as a demo for now.


wp

  • Hero Member
  • *****
  • Posts: 13431
Re: Fit tool
« Reply #2 on: October 02, 2012, 05:00:18 pm »
Quote
So I'll leave it as a demo for now.
Fine. Thanks for adding the end bars which I forgot.

 

TinyPortal © 2005-2018