HighMap library (C++)
Loading...
Searching...
No Matches
hmap::Edge Class Reference

Represents a line segment in 2D space. More...

#include <edge.hpp>

Collaboration diagram for hmap::Edge:

Public Member Functions

 Edge (Point p1, Point p2, float w)
 Constructs an Edge object with specified start and end points and a weight.
 
 Edge (Point p1, Point p2)
 Constructs an Edge object with specified start and end points and a default weight of 0.
 
float length ()
 Computes the length of the edge.
 

Public Attributes

Point p1
 The start point of the edge.
 
Point p2
 The end point of the edge.
 
float w
 A weight associated with the edge.
 

Detailed Description

Represents a line segment in 2D space.

The Edge class defines a line segment using two Point objects to represent the start and end of the segment. Additionally, it has a weight associated with the edge, and provides functionality to compute the length of the segment.

Constructor & Destructor Documentation

◆ Edge() [1/2]

hmap::Edge::Edge ( Point  p1,
Point  p2,
float  w 
)
inline

Constructs an Edge object with specified start and end points and a weight.

Parameters
p1The start point of the edge.
p2The end point of the edge.
wThe weight associated with the edge.

◆ Edge() [2/2]

hmap::Edge::Edge ( Point  p1,
Point  p2 
)
inline

Constructs an Edge object with specified start and end points and a default weight of 0.

Parameters
p1The start point of the edge.
p2The end point of the edge.

Member Function Documentation

◆ length()

float hmap::Edge::length ( )
inline

Computes the length of the edge.

This function calculates the distance between the start and end points of the edge.

Returns
The length of the edge.

Member Data Documentation

◆ p1

Point hmap::Edge::p1

The start point of the edge.

◆ p2

Point hmap::Edge::p2

The end point of the edge.

◆ w

float hmap::Edge::w

A weight associated with the edge.


The documentation for this class was generated from the following file: