File: init_fading.c

package info (click to toggle)
garlic 1.6-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 4,516 kB
  • sloc: ansic: 52,465; makefile: 2,254
file content (88 lines) | stat: -rw-r--r-- 2,271 bytes parent folder | download | duplicates (6)
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
/* Copyright (C) 2000 Damir Zucic */

/*=============================================================================

				init_fading.c

Purpose:
	Initialize color fading data: reference point (center) position,
	front surface and back surface distance from the center.
	
Input:
	(1) Pointer to MolComplexS structure.

Output:
	(1) Color fading parameters initialized.

Return value:
	No return value.

========includes:============================================================*/

#include <stdio.h>

#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
#include <X11/Xatom.h>

#include "defines.h"
#include "typedefs.h"

/*======initialize color fading parameters:==================================*/

void InitFading_ (MolComplexS *mol_complexSP)
{
double		relative_z0, relative_z1;
double		fading_z0, fading_z1;


/* Initialize the reference point: */
mol_complexSP->fading_center_vectorS.x =
				mol_complexSP->geometric_center_vectorS.x;
mol_complexSP->fading_center_vectorS.y =
				mol_complexSP->geometric_center_vectorS.y;
mol_complexSP->fading_center_vectorS.z =
				mol_complexSP->geometric_center_vectorS.z;

/* Prepare the extreme z values (relative to the fading center): */
relative_z0 = mol_complexSP->left_top_near_vectorS.z -
	      mol_complexSP->fading_center_vectorS.z;
relative_z1 = mol_complexSP->right_bottom_far_vectorS.z -
	      mol_complexSP->fading_center_vectorS.z;

/* Set the initial front and back surface distance */
/* from the center.  This depends on fading style. */
switch (mol_complexSP->fading_modeI)
	{
	/** Fading off (all atoms should be colored as near atoms): **/
	case 0:
		break;

	/** Planar: **/
	case 1:
		fading_z0 = relative_z0;
		fading_z1 = relative_z1;
		mol_complexSP->fading_front_relative_position = fading_z0;
		mol_complexSP->fading_back_relative_position  = fading_z1;
		break;

	/** Sphere, half-sphere, cylinder and half-cylinder: **/
	case 2:
	case 3:
	case 4:
	case 5:
		fading_z0 = -relative_z0;
		fading_z1 = 0.0;
		mol_complexSP->fading_front_relative_position = fading_z0;
		mol_complexSP->fading_back_relative_position  = fading_z1;

	/** Unsupported fading modes (do nothing): **/
	default:
		;
	}
}

/*===========================================================================*/