Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Trees
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Benedikt Kraus
Trees
Commits
e81e3cde
Commit
e81e3cde
authored
6 years ago
by
Hendrik Schwanekamp
Browse files
Options
Downloads
Patches
Plain Diff
give tree a set diameter function
parent
cde25bb3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Projekt/Tree.py
+14
-0
14 additions, 0 deletions
Projekt/Tree.py
Projekt/TreeSpecies.py
+1
-1
1 addition, 1 deletion
Projekt/TreeSpecies.py
with
15 additions
and
1 deletion
Projekt/Tree.py
+
14
−
0
View file @
e81e3cde
import
numpy
as
np
import
TreeSpecies
as
ts
import
TreeModel
as
mdl
class
Tree
:
...
...
@@ -7,7 +8,20 @@ class Tree:
truncDiameter
=
0.0
# tree diameter in centimeter
truncRadius
=
0.0
# tree radius in centimeter
leafRadius
=
0.0
# leaf radius in centimeter
leafArea
=
0.0
# the leaf area of the tree
height
=
0.0
# height of the tree
species
=
ts
.
null
# tree species
isAlive
=
True
# is the tree still alive?
def
setDiameter
(
self
,
dia
):
"""
Set a new diameter for the tree and recalculate all diameter dependent properties.
"""
self
.
truncDiameter
=
dia
self
.
truncRadius
=
dia
/
2
self
.
leafArea
=
mdl
.
getLeafArea
(
self
.
species
.
c
,
self
.
truncDiameter
)
self
.
leafRadius
=
np
.
sqrt
(
self
.
leafArea
/
np
.
pi
)
self
.
height
=
mdl
.
getHeight
(
self
.
truncDiameter
,
self
.
species
.
hmax
,
self
.
species
.
dmax
)
def
__init__
(
self
,
pos
,
spec
,
dia
=
0.5
):
self
.
position
=
pos
self
.
species
=
spec
self
.
setDiameter
(
dia
)
This diff is collapsed.
Click to expand it.
Projekt/TreeSpecies.py
+
1
−
1
View file @
e81e3cde
...
...
@@ -24,7 +24,7 @@ class TreeSpecies:
self
.
trunkColor
=
trunkColor
null
=
TreeSpecies
(
0
,
0
,
0
,
0
,
0
)
null
=
TreeSpecies
(
0
,
0
,
0
,
0
.1
,
0.1
)
maple
=
TreeSpecies
(
3011
,
152.5
,
170
,
1.57
,
200
,
'
brown
'
,
'
green
'
)
beech
=
TreeSpecies
(
2660
,
122
,
150
,
2.2
,
300
,
'
brown
'
,
'
green
'
)
fir
=
TreeSpecies
(
1830
,
50
,
200
,
2.5
,
80
,
'
brown
'
,
'
green
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment