Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

[r1]: trunk / Variations / varHemisphere.pas Maximize Restore History

Download this file

varHemisphere.pas    98 lines (72 with data), 2.7 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
{
Apophysis Copyright (C) 2001-2004 Mark Townsend
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
Apophysis "3D hack" Copyright (C) 2007-2008 Peter Sdobnov
Apophysis "7X" Copyright (C) 2009-2010 Georg Kiehne
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
}
unit varHemisphere;
interface
uses
BaseVariation, XFormMan;
const
var_name = 'hemisphere';
{$define _ASM_}
type
TVariationHemisphere = class(TBaseVariation)
private
public
constructor Create;
class function GetName: string; override;
class function GetInstance: TBaseVariation; override;
function GetNrVariables: integer; override;
procedure CalcFunction; override;
end;
implementation
uses
Math;
{ TVariationSpherize }
///////////////////////////////////////////////////////////////////////////////
procedure TVariationHemisphere.CalcFunction;
var
t: double;
begin
t := vvar / sqrt(sqr(FTx^) + sqr(FTy^) + 1);
FPx^ := FPx^ + FTx^ * t;
FPy^ := FPy^ + FTy^ * t;
FPz^ := FPz^ + t;
end;
///////////////////////////////////////////////////////////////////////////////
constructor TVariationHemisphere.Create;
begin
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationHemisphere.GetInstance: TBaseVariation;
begin
Result := TVariationHemisphere.Create;
end;
///////////////////////////////////////////////////////////////////////////////
class function TVariationHemisphere.GetName: string;
begin
Result := var_name;
end;
///////////////////////////////////////////////////////////////////////////////
function TVariationHemisphere.GetNrVariables: integer;
begin
Result := 0;
end;
///////////////////////////////////////////////////////////////////////////////
initialization
RegisterVariation(TVariationClassLoader.Create(TVariationHemisphere), true, false);
end.