okular
#include "annotations.h"
#include "annotations_p.h"
#include <QApplication>
#include <QColor>
#include <float.h>
#include "action.h"
#include "document.h"
#include "document_p.h"
#include "movie.h"
#include "page_p.h"
#include "sound.h"
Go to the source code of this file.
Macros  
#define  ADD_COORD(c1, c2) 
Functions  
static CaretAnnotation::CaretSymbol  caretSymbolFromString (const QString &symbol) 
static QString  caretSymbolToString (CaretAnnotation::CaretSymbol symbol) 
static double  distanceSqr (double x, double y, double xScale, double yScale, const QLinkedList< NormalizedPoint > &path) 
static bool  isLeftOfVector (const NormalizedPoint &a, const NormalizedPoint &b, const NormalizedPoint &c) 
static double  strokeDistance (double distance, double penWidth) 
Macro Definition Documentation
#define ADD_COORD  (  c1,  
c2  
) 
Function Documentation

static 
Definition at line 2451 of file annotations.cpp.

static 
Definition at line 2439 of file annotations.cpp.

static 
Calculates distance of the given point x
y
xScale
yScale
to the path
.
Does piecewise comparison and selects the distance to the closest segment
Definition at line 45 of file annotations.cpp.

static 
True, if point c
lies to the left of the vector from a
to b
.
Definition at line 34 of file annotations.cpp.

static 
Given the squared distance
from the idealized 0width line and a pen width penWidth
, (not squared!), returns the final distance.
 Warning
 The returned distance is not exact: We calculate an (exact) squared distance to the ideal (centered) line, and then subtract the squared width of the pen: a^2  b^2 where a = "distance from idealized 0width line" b = "pen width" For an exact result, we would want to calculate "(a  b)^2" but that would require a square root operation because we only know the squared distance a^2.
However, the approximation is feasible, because: error = (ab)^2  (a^2  b^2) = 2ab + 2b^2 = 2b(b  a) Therefore: lim_{a>b} a^2  b^2  a^2 + 2ab  b^2 –> 0
In other words, this approximation will estimate the distance to be slightly more than it actually is for as long as we are far "outside" the line, becoming more accurate the closer we get to the line boundary. Trivially, it also fulfils (a1 < a2) => ((a1^2  b^2) < (a2^2  b^2)) making it monotonic. "Inside" of the drawn line, the distance is 0 anyway.
Definition at line 84 of file annotations.cpp.
Documentation copyright © 19962020 The KDE developers.
Generated on Sat Jan 18 2020 04:31:22 by doxygen 1.8.7 written by Dimitri van Heesch, © 19972006
KDE's Doxygen guidelines are available online.