added AQDG_Graph_DataPair_List_GetMinDiffX/Y()
This commit is contained in:
@@ -22,6 +22,82 @@
|
|||||||
<header type="sys" loc="pre">aqdiagram/aqdg_api.h</header>
|
<header type="sys" loc="pre">aqdiagram/aqdg_api.h</header>
|
||||||
</headers>
|
</headers>
|
||||||
|
|
||||||
|
<inlines>
|
||||||
|
<inline loc="end" access="public">
|
||||||
|
<content>
|
||||||
|
$(api) double $(struct_prefix)_List_GetMinDiffX(const $(struct_type)_LIST *st);
|
||||||
|
</content>
|
||||||
|
</inline>
|
||||||
|
|
||||||
|
<inline loc="code">
|
||||||
|
<content>
|
||||||
|
double $(struct_prefix)_List_GetMinDiffX(const $(struct_type)_LIST *stList) \n
|
||||||
|
{ \n
|
||||||
|
int idx=0; \n
|
||||||
|
double diff=0.0; \n
|
||||||
|
const $(struct_type) *dp; \n
|
||||||
|
const $(struct_type) *dpPrevious=NULL; \n
|
||||||
|
\n
|
||||||
|
dp=$(struct_prefix)_List_First(stList); \n
|
||||||
|
while(dp) { \n
|
||||||
|
if (idx==1) \n
|
||||||
|
diff=dp->valueX-dpPrevious->valueX; \n
|
||||||
|
else if (idx>1) { \n
|
||||||
|
double newDiff; \n
|
||||||
|
\n
|
||||||
|
newDiff=dp->valueX-dpPrevious->valueX; \n
|
||||||
|
if (newDiff<diff) \n
|
||||||
|
diff=newDiff; \n
|
||||||
|
} \n
|
||||||
|
dpPrevious=dp; \n
|
||||||
|
idx++; \n
|
||||||
|
\n
|
||||||
|
dp=$(struct_prefix)_List_Next(dp); \n
|
||||||
|
} \n
|
||||||
|
return diff; \n
|
||||||
|
} \n
|
||||||
|
</content>
|
||||||
|
</inline>
|
||||||
|
|
||||||
|
<inline loc="end" access="public">
|
||||||
|
<content>
|
||||||
|
$(api) double $(struct_prefix)_List_GetMinDiffY(const $(struct_type)_LIST *st);
|
||||||
|
</content>
|
||||||
|
</inline>
|
||||||
|
|
||||||
|
<inline loc="code">
|
||||||
|
<content>
|
||||||
|
double $(struct_prefix)_List_GetMinDiffY(const $(struct_type)_LIST *stList) \n
|
||||||
|
{ \n
|
||||||
|
int idx=0; \n
|
||||||
|
double diff=0.0; \n
|
||||||
|
const $(struct_type) *dp; \n
|
||||||
|
const $(struct_type) *dpPrevious=NULL; \n
|
||||||
|
\n
|
||||||
|
dp=$(struct_prefix)_List_First(stList); \n
|
||||||
|
while(dp) { \n
|
||||||
|
if (idx==1) \n
|
||||||
|
diff=dp->valueY-dpPrevious->valueY; \n
|
||||||
|
else if (idx>1) { \n
|
||||||
|
double newDiff; \n
|
||||||
|
\n
|
||||||
|
newDiff=dp->valueY-dpPrevious->valueY; \n
|
||||||
|
if (newDiff<diff) \n
|
||||||
|
diff=newDiff; \n
|
||||||
|
} \n
|
||||||
|
dpPrevious=dp; \n
|
||||||
|
idx++; \n
|
||||||
|
\n
|
||||||
|
dp=$(struct_prefix)_List_Next(dp); \n
|
||||||
|
} \n
|
||||||
|
return diff; \n
|
||||||
|
} \n
|
||||||
|
</content>
|
||||||
|
</inline>
|
||||||
|
|
||||||
|
</inlines>
|
||||||
|
|
||||||
|
|
||||||
</lang>
|
</lang>
|
||||||
|
|
||||||
<members>
|
<members>
|
||||||
|
|||||||
Reference in New Issue
Block a user