JavaCAD
src
main
java
eu
mihosoft
vrl
v3d
ZModifier.java
Go to the documentation of this file.
1
/*
2
* To change this license header, choose License Headers in Project Properties.
3
* To change this template file, choose Tools | Templates
4
* and open the template in the editor.
5
*/
6
package
eu.mihosoft.vrl.v3d;
7
8
// TODO: Auto-generated Javadoc
14
public
class
ZModifier
implements
WeightFunction
{
15
17
private
Bounds
bounds
;
18
20
private
double
min
= 0;
21
23
private
double
max
= 1.0;
24
26
private
double
sPerUnit
;
27
29
private
boolean
centered
;
30
34
public
ZModifier
() {
35
}
36
42
public
ZModifier
(
boolean
centered
) {
43
this.centered =
centered
;
44
}
45
46
/* (non-Javadoc)
47
* @see eu.mihosoft.vrl.v3d.WeightFunction#eval(eu.mihosoft.vrl.v3d.Vector3d, eu.mihosoft.vrl.v3d.CSG)
48
*/
49
@Override
50
public
double
eval
(
Vector3d
pos,
CSG
csg) {
51
52
if
(
bounds
==
null
) {
53
this.bounds = csg.
getBounds
();
54
sPerUnit
= (
max
-
min
) / (
bounds
.
getMax
().
z
-
bounds
.
getMin
().
z
);
55
}
56
57
double
s =
sPerUnit
* (pos.
z
-
bounds
.
getMin
().
z
);
58
59
if
(
centered
) {
60
s = s - (
max
-
min
) / 2.0;
61
62
s = Math.abs(s) * 2;
63
}
64
65
return
s;
66
}
67
68
}
eu.mihosoft.vrl.v3d.Bounds
Definition:
Bounds.java:14
eu.mihosoft.vrl.v3d.Bounds.getMax
Vector3d getMax()
Definition:
Bounds.java:201
eu.mihosoft.vrl.v3d.Bounds.getMin
Vector3d getMin()
Definition:
Bounds.java:192
eu.mihosoft.vrl.v3d.CSG
Definition:
CSG.java:109
eu.mihosoft.vrl.v3d.CSG.getBounds
Bounds getBounds()
Definition:
CSG.java:1738
eu.mihosoft.vrl.v3d.Vector3d
Definition:
Vector3d.java:48
eu.mihosoft.vrl.v3d.Vector3d.z
static Vector3d z(double z)
Definition:
Vector3d.java:494
eu.mihosoft.vrl.v3d.ZModifier
Definition:
ZModifier.java:14
eu.mihosoft.vrl.v3d.ZModifier.sPerUnit
double sPerUnit
Definition:
ZModifier.java:26
eu.mihosoft.vrl.v3d.ZModifier.eval
double eval(Vector3d pos, CSG csg)
Definition:
ZModifier.java:50
eu.mihosoft.vrl.v3d.ZModifier.ZModifier
ZModifier()
Definition:
ZModifier.java:34
eu.mihosoft.vrl.v3d.ZModifier.min
double min
Definition:
ZModifier.java:20
eu.mihosoft.vrl.v3d.ZModifier.ZModifier
ZModifier(boolean centered)
Definition:
ZModifier.java:42
eu.mihosoft.vrl.v3d.ZModifier.centered
boolean centered
Definition:
ZModifier.java:29
eu.mihosoft.vrl.v3d.ZModifier.max
double max
Definition:
ZModifier.java:23
eu.mihosoft.vrl.v3d.ZModifier.bounds
Bounds bounds
Definition:
ZModifier.java:17
eu.mihosoft.vrl.v3d.WeightFunction
Definition:
WeightFunction.java:16
Generated by
1.9.1