Go to the documentation of this file.
1 /*--------------------------------------------------------------------------------------+
2 |
3 | Supplied under applicable software license agreement.
4 |
5 | Copyright (c) 2018 Bentley Systems, Incorporated. All rights reserved.
6 |
7 +---------------------------------------------------------------------------------------*/
8 #pragma once
19 struct DSegment1d
20 {
21 private:
22 double m_x0, m_x1;
23 public:
25 GEOMDLLIMPEXP DSegment1d (double x0, double x1);
27 GEOMDLLIMPEXP DSegment1d (double x);
31 GEOMDLLIMPEXP void SetStart (double x);
33 GEOMDLLIMPEXP void SetEnd (double x);
36 GEOMDLLIMPEXP double GetStart () const;
38 GEOMDLLIMPEXP double GetEnd () const;
41 GEOMDLLIMPEXP double EndPointProduct (double x) const;
44 GEOMDLLIMPEXP bool IsStrictInterior (double x) const;
47 GEOMDLLIMPEXP bool IsEqual (DSegment1dCR other) const;
49 GEOMDLLIMPEXP bool IsReversed (DSegment1dCR other) const;
52 GEOMDLLIMPEXP double FractionToPoint (double fraction) const;
55 GEOMDLLIMPEXP bool PointToFraction (double point, double &fraction) const;
57 GEOMDLLIMPEXP double Length () const;
59 GEOMDLLIMPEXP double Delta () const;
64 GEOMDLLIMPEXP bool static DirectedOverlap (DSegment1dCR primary, DSegment1dCR clipper, DSegment1dR result);
68 GEOMDLLIMPEXP bool static NonZeroDirectedOverlap (DSegment1dCR primary, DSegment1dCR clipper, DSegment1dR result);
71 GEOMDLLIMPEXP DSegment1d BetweenFractions (double f0, double f1) const;
73 GEOMDLLIMPEXP DSegment1d Reverse () const;
75 GEOMDLLIMPEXP void ReverseInPlace ();
76 };
void ReverseInPlace()
reverse the instance in place
double Delta() const
Return signed distance from start to end.
Definition: Bentley.r.h:30
bool IsEqual(DSegment1dCR other) const
Exact equality test.
void SetEnd(double x)
Change end coordinate.
bool IsReversed(DSegment1dCR other) const
Exact equality test for reversed coordinates.
double Length() const
Return absolute length of the segment.
bool PointToFraction(double point, double &fraction) const
Find fractional parameter for specified coordinate.
struct DSegment1d const & DSegment1dCR
Definition: msgeomstructs_typedefs.h:144
double GetEnd() const
Return end coordinate.
double EndPointProduct(double x) const
return (x-x0) * (x-x1). This is negative "inside" the interval
A DSegment1d is an interval [x0,x1] on the real line.
Definition: DSegment1d.h:19
DSegment1d Reverse() const
return reverse of the instance
DSegment1d(double x0, double x1)
Constructor with distinct endpoints.
double GetStart() const
Return start coordinate.
static bool NonZeroDirectedOverlap(DSegment1dCR primary, DSegment1dCR clipper, DSegment1dR result)
Find overlap of primary with clipper, treating single point intersection as empty.
double FractionToPoint(double fraction) const
Return coordinate at fractional parameter from start to end.
struct DSegment1d & DSegment1dR
Definition: msgeomstructs_typedefs.h:144
static bool DirectedOverlap(DSegment1dCR primary, DSegment1dCR clipper, DSegment1dR result)
Find overlap of primary with clipper.
Definition: Bentley.r.h:29
void SetStart(double x)
Change start coordinate.
DSegment1d BetweenFractions(double f0, double f1) const
Return a segment with endpoints at fractions of input segment.
bool IsStrictInterior(double x) const
Test if the EndPointProduct is negative.

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.