• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegraphics API Reference
  • KDE Home
  • Contact Us
 

okular

  • sources
  • kde-4.12
  • kdegraphics
  • okular
  • core
Macros | Functions
annotations.cpp File Reference
#include "annotations.h"
#include "annotations_p.h"
#include <QtGui/QApplication>
#include <QtGui/QColor>
#include <float.h>
#include "action.h"
#include "document.h"
#include "document_p.h"
#include "movie.h"
#include "page_p.h"
#include "sound.h"
Include dependency graph for annotations.cpp:

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 
)
Value:
{ \
c1.x = c1.x + c2.x; \
c1.y = c1.y + c2.y; \
}

Function Documentation

static CaretAnnotation::CaretSymbol caretSymbolFromString ( const QString &  symbol)
static

Definition at line 2378 of file annotations.cpp.

static QString caretSymbolToString ( CaretAnnotation::CaretSymbol  symbol)
static

Definition at line 2366 of file annotations.cpp.

static double distanceSqr ( double  x,
double  y,
double  xScale,
double  yScale,
const QLinkedList< NormalizedPoint > &  path 
)
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 bool isLeftOfVector ( const NormalizedPoint &  a,
const NormalizedPoint &  b,
const NormalizedPoint &  c 
)
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 double strokeDistance ( double  distance,
double  penWidth 
)
static

Given the squared distance from the idealized 0-width 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 0-width 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 = (a-b)^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.

This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:45:03 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

okular

Skip menu "okular"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdegraphics API Reference

Skip menu "kdegraphics API Reference"
  •     libkdcraw
  •     libkexiv2
  •     libkipi
  •     libksane
  • okular

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal