Point2.h File Reference
`#include "common.h"`
`#include "Vector2.h"`
`#include <cstring>`

Go to the source code of this file.

Point. More...

## Functions

Point2 GEOM_FADE2D::center (const Point2 &p0, const Point2 &p1)
Compute the midpoint of p0 and p1. More...

Point2 GEOM_FADE2D::centerWithShift (const Point2 &p0, const Point2 &p1)
Compute the midpoint of p0 and p1 and adapt it. More...

std::ostream & GEOM_FADE2D::operator<< (std::ostream &stream, const Point2 &pnt)
Print to stream.

std::istream & GEOM_FADE2D::operator>> (std::istream &stream, Point2 &pnt)
Stream-to-Point.

double GEOM_FADE2D::sqDistance2D (const double x0, const double y0, const Point2 &p1)
Get the squared distance between two points in 2D.

double GEOM_FADE2D::sqDistance2D (const Point2 &p0, const Point2 &p1)
Get the squared distance between two points in 2D.

## ◆ center()

 Point2 GEOM_FADE2D::center ( const Point2 & p0, const Point2 & p1 )
inline

Compute the midpoint of p0 and p1.

Note
: The exact midpoint of p0 and p1 may not exist in floating point numbers. Thus the returned point may not be collinear with p0 and p1.

## ◆ centerWithShift()

 Point2 GEOM_FADE2D::centerWithShift ( const Point2 & p0, const Point2 & p1 )

Compute the midpoint of p0 and p1 and adapt it.

Experimental new function that may change in the future. Thought for specific applications.

This function works like center() but additionally it adapts the midpoint to the segment (p0,p1) such that it is 'as collinear as possible' with p0 and p1 in the x/y plane. Bounds for the shift are 0.01 and 1 % of the range in x- and y-direction.