Update procedures
[shapes.git] / source / zbufinternals.h
blob699bdac454ad3df7cbdbe9522b8d7cbd9c044882
1 /* This file is part of Shapes.
3 * Shapes is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * any later version.
8 * Shapes is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with Shapes. If not, see <http://www.gnu.org/licenses/>.
16 * Copyright 2008 Henrik Tidefelt
19 #pragma once
21 #include "elementarycoords.h"
23 #include <vector>
25 namespace Shapes
27 namespace Computation
30 class SplicingLine
32 public:
33 bool isTriangleSide_;
34 // The line is defined in several ways. First, by p0_ -- (p0_+lengt_*d_), where d_ is unit:
35 Concrete::Coords2D p0_;
36 Concrete::UnitFloatPair d_;
37 Concrete::Length length_;
39 // The line through p0 -- p1 is given by x: <x,n_> == r_, where n_ is unit.
40 Concrete::UnitFloatPair n_;
41 Concrete::Length r_;
43 std::vector< const Concrete::Coords2D * > intersections_;
45 SplicingLine( const Concrete::Coords2D & p0, const Concrete::Coords2D & p1_sub_p0, bool isTriangleSide );
46 SplicingLine( const SplicingLine & orig );
47 explicit SplicingLine( ); // Only to be used to create a destination object.
49 Concrete::Coords2D intersection( const Computation::SplicingLine & other ) const;
50 size_t nextLine( const Concrete::Coords2D * p, const Concrete::UnitFloatPair & n, const std::vector< Computation::SplicingLine > & lines ) const;
51 Concrete::Length distanceTo( const Concrete::Coords2D p ) const;