~ubuntu-branches/ubuntu/breezy/garlic/breezy

« back to all changes in this revision

Viewing changes to init_fading.c

  • Committer: Bazaar Package Importer
  • Author(s): zhaoway
  • Date: 2001-04-24 07:09:13 UTC
  • Revision ID: james.westby@ubuntu.com-20010424070913-uzpupnwdfhmliebz
Tags: upstream-1.1
ImportĀ upstreamĀ versionĀ 1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2000 Damir Zucic */
 
2
 
 
3
/*=============================================================================
 
4
 
 
5
                                init_fading.c
 
6
 
 
7
Purpose:
 
8
        Initialize color fading data: reference point (center) position,
 
9
        front surface and back surface distance from the center.
 
10
        
 
11
Input:
 
12
        (1) Pointer to MolComplexS structure.
 
13
 
 
14
Output:
 
15
        (1) Color fading parameters initialized.
 
16
 
 
17
Return value:
 
18
        No return value.
 
19
 
 
20
========includes:============================================================*/
 
21
 
 
22
#include <stdio.h>
 
23
 
 
24
#include <X11/Xlib.h>
 
25
#include <X11/Xutil.h>
 
26
#include <X11/Xos.h>
 
27
#include <X11/Xatom.h>
 
28
 
 
29
#include "defines.h"
 
30
#include "typedefs.h"
 
31
 
 
32
/*======initialize color fading parameters:==================================*/
 
33
 
 
34
void InitFading_ (MolComplexS *mol_complexSP)
 
35
{
 
36
double          relative_z0, relative_z1;
 
37
double          fading_z0, fading_z1;
 
38
 
 
39
 
 
40
/* Initialize the reference point: */
 
41
mol_complexSP->fading_center_vectorS.x =
 
42
                                mol_complexSP->geometric_center_vectorS.x;
 
43
mol_complexSP->fading_center_vectorS.y =
 
44
                                mol_complexSP->geometric_center_vectorS.y;
 
45
mol_complexSP->fading_center_vectorS.z =
 
46
                                mol_complexSP->geometric_center_vectorS.z;
 
47
 
 
48
/* Prepare the extreme z values (relative to the fading center): */
 
49
relative_z0 = mol_complexSP->left_top_near_vectorS.z -
 
50
              mol_complexSP->fading_center_vectorS.z;
 
51
relative_z1 = mol_complexSP->right_bottom_far_vectorS.z -
 
52
              mol_complexSP->fading_center_vectorS.z;
 
53
 
 
54
/* Set the initial front and back surface distance */
 
55
/* from the center.  This depends on fading style. */
 
56
switch (mol_complexSP->fading_modeI)
 
57
        {
 
58
        /** Fading off (all atoms should be colored as near atoms): **/
 
59
        case 0:
 
60
                break;
 
61
 
 
62
        /** Planar: **/
 
63
        case 1:
 
64
                fading_z0 = relative_z0;
 
65
                fading_z1 = relative_z1;
 
66
                mol_complexSP->fading_front_relative_position = fading_z0;
 
67
                mol_complexSP->fading_back_relative_position  = fading_z1;
 
68
                break;
 
69
 
 
70
        /** Sphere, half-sphere, cylinder and half-cylinder: **/
 
71
        case 2:
 
72
        case 3:
 
73
        case 4:
 
74
        case 5:
 
75
                fading_z0 = -relative_z0;
 
76
                fading_z1 = 0.0;
 
77
                mol_complexSP->fading_front_relative_position = fading_z0;
 
78
                mol_complexSP->fading_back_relative_position  = fading_z1;
 
79
 
 
80
        /** Unsupported fading modes (do nothing): **/
 
81
        default:
 
82
                ;
 
83
        }
 
84
}
 
85
 
 
86
/*===========================================================================*/
 
87
 
 
88